In GIT, we have a file called .gitignore, what is the technical term to call them, (are files like these valid to be called as "filename"), What are they supposed to be called?
I have written a simple script in python to change the name of files, however, Python doesn't seem to recognize folders and files that starts with a dot (.) such as .git, .gitignore etc
import os
import glob
rootdir = 'C:\\INBOX\\POLINATE\\JUNKS\\**'
# #work on files
for filename in glob.iglob(rootdir, recursive=True):
if os.path.isfile(filename): # filter dirs
print(filename)
try:
##rename
new_filename = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(14)).lower()
new_extension = new_filename[0:3]
final_name = os.path.dirname(filename) + os.sep + new_filename+'.'+new_extension
os.rename(filename,final_name)
print(final_name)
except Exception as e:
#raise e
print(e)
Script above works for files with Xn.3 format (Xn filenames within allowable range including spaces).(Three (3) letter extension) but it leaves files starting with a dot (.)