# Add a file's modified time to the front of the name of the file in the format # YYYY-MM-DD-<original-filenam>. # # Works for files in the current directory. from os import listdir from os.path import isfile, join import os import time mypath = "." onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] for file in onlyfiles: newname = time.strftime('%Y-%m-%d-', time.gmtime(os.path.getmtime(file))) + file print("Renaming file: " + file + " to: " newname) os.rename(file, time.strftime('%Y-%m-%d-', time.gmtime(os.path.getmtime(file))) + file)
robocopy C:\Users\username\Documents\ E:\Backup\ /MIR /XJD > Backup.log echo "DONE" >> Backup.log Dry Run: robocopy C:\Users\username\Documents\ E:\Backup\ /MIR /XJD /L > Backup.log rem Copy files to backup volume rem /MIR - Mirror files (delete files on destination that aren't on the source) rem /XJD - Exclude junction points for directories (may cause infinite loops) rem /sl - Don't follow symbolic links and instead create a copy of the link. rem /FFT - 2 second difference when comparing timestamps rem /R:3 - Only retry 3 times (default is 1 million) rem /W:10 - Wait time between retries (default is 30) rem /Z - Copies files in restart mode (NOTE: This WILL slow down copying) rem /B - Backup mode - allows copy of open files (must run as Admin) rem NOTE: /Z and /B can be combined as /ZB rem /NP - Don't output progress of copy operation rem /log:backup.log - Logs to backup.log, overwriting old log file (use /log+: to append) rem /