I am trying to rename a file in which it is auto-generated by some local modules but I was wondering if using os.listdir is the only way for me to filter/ narrow down this file.
This file will always be generated before it is removed and the code will generate the next one (still in the same directory) based on the next item in list.
Basically, whenever this file is generated, it comes in the following file path:
/user_data/.tmp/tempLibFiles/2015_03_16_192212_182096.con
I had only wanted to rename the 2015_03_16_192212_182096 into connectionFile while keeping the rest the same.
glob.globis much shorter :)glob.glob, while in this question, the OP was apparently unaware ofglob.globin the first place, and the pattern seems simple enough to be matchable with simple shell-style globbing patterns.glob.iglob, based on this [link] (stackoverflow.com/questions/225735/…) first solution. Sadly there still seems to be some problem as I am unable to grab the 'output' of the renamed convention unless I am going to do another round of finding/ narrowing the file within the directory