Jongskie M.
Technical User
Dear Gents,
Below code shows on how to copy the recent file from source to destination, and when I compiled it just only pops & nothing happens, kindly help and reencode. thanks.
src.dest202410150039728.txt <-- this file should be copied to the destination.
src.dest20241008012256.txt
========
src_files = [f for f in os.listdir(r"D:\\LAB\\source\\")
if f.endswith('*.txt') and datetime.fromtimestamp(os.path.getmtime(f)).date() >= today]
if dest_files:
path = r'D:\\LAB\\dest\\{short_month} {year}'
print("File detected {dest_files}")
shutil.sleep(1)
for ste in dest_files:
src_path = r'D:\\LAB\\dest\\{ste}'
dest_path = os.path.join(path)
print("Copying File" + ste)
shutil.copy(src_path, dest_path)
input("Filecheck")
os.startfile(path)
else:
print("File is unavailable!")
Below code shows on how to copy the recent file from source to destination, and when I compiled it just only pops & nothing happens, kindly help and reencode. thanks.
src.dest202410150039728.txt <-- this file should be copied to the destination.
src.dest20241008012256.txt
========
src_files = [f for f in os.listdir(r"D:\\LAB\\source\\")
if f.endswith('*.txt') and datetime.fromtimestamp(os.path.getmtime(f)).date() >= today]
if dest_files:
path = r'D:\\LAB\\dest\\{short_month} {year}'
print("File detected {dest_files}")
shutil.sleep(1)
for ste in dest_files:
src_path = r'D:\\LAB\\dest\\{ste}'
dest_path = os.path.join(path)
print("Copying File" + ste)
shutil.copy(src_path, dest_path)
input("Filecheck")
os.startfile(path)
else:
print("File is unavailable!")