now adding timestamp
This commit is contained in:
parent
5ecd3cc79c
commit
681f434386
@ -23,9 +23,17 @@ def files(path):
|
|||||||
yield os.path.join(subdir, file)
|
yield os.path.join(subdir, file)
|
||||||
|
|
||||||
def save_input(oldpath):
|
def save_input(oldpath):
|
||||||
# make timestampt the filename, so it wouln't overwrite
|
# add timestamp to the filename, so it wouln't overwrite but the user still knows which file's which
|
||||||
timestamp = str(int(time.time()))
|
timestamp = str(int(time.time()))
|
||||||
filename = timestamp + '.' + oldpath.split('.')[-1]
|
basename = os.path.basename(oldpath)
|
||||||
|
try:
|
||||||
|
basename.index('.')
|
||||||
|
basename_no_extension = basename[:basename.index('.')]
|
||||||
|
extension = basename[index_of_dot:]
|
||||||
|
except ValueError:
|
||||||
|
basename_no_extension = basename
|
||||||
|
extension = ''
|
||||||
|
filename = basename_no_extension + '_' + timestamp + extension
|
||||||
newpath = inputFilePath + '\\' + filename
|
newpath = inputFilePath + '\\' + filename
|
||||||
shutil.copy(oldpath, newpath)
|
shutil.copy(oldpath, newpath)
|
||||||
return newpath
|
return newpath
|
||||||
|
Loading…
Reference in New Issue
Block a user