Code: Select all
#SingleInstance
global SourceFolder
global CopyToFolder1
global CopyToFolder2
global MoveToFolder1
global TimeFormatStr
global AgeOfFilesToExclude
SourceFolder=\\Photoboothpc\eye-fi-card-in ; Source of files
CopyToFolder1=C:\Users\UEG\Dropbox\UEG-Social\Photos-INN ; Copy to Dropbox
CopyToFolder2=C:\Users\UEG\OneDrive\PhotoSystem\LobbyPhotos-IN ; copy for lobby photos
MoveToFolder1=C:\Users\UEG\OneDrive\PhotoSystem\Photos-ARCHIVE ; MOVE (copy & delete) to archive folder
TimeFormatStr := "yyyy-MM-dd_HH'H'-mm'M'-ss'S'" ; set the format of time time
AgeOfFilesToExclude = -10 ; curently minutes, but could be change to hours/days/etc
;*******************END CONFIGURATION SECTION*******************
runcopyscript()
;*******************Function below
runcopyscript()
{
TimeNow = %A_Now% ; gets system time
TimeNow += %AgeOfFilesToExclude%, Minutes ; curently minutes, but could be change to hours/days/etc
Loop %SourceFolder%\*.* ; Loop the folder for all files (or change *.* so something else)
{
If (A_LoopFileTimeModified < TimeNow)
{
OriginalFileName = %A_LoopFileLongPath% ; get full name-path of file
FileGetTime, NewFileName, %OriginalFileName%, M ; get time stamp of file, "M" is "last modified" time
FormatTime, TimeStr, %NewFileName%, %TimeFormatStr% ; format the time string
FileExtension = %A_LoopFileExt% ; get the file extension of the file
StringLower, FileExtension, FileExtension ; convert file extension to lower case, in case it is not.
NewFileName = %TimeStr%.%FileExtension% ; build the name of the NEW file
FileCopy, %OriginalFileName%, %CopyToFolder1%\%NewFileName% ; Copy to location ONE and give new name.
FileCopy, %OriginalFileName%, %CopyToFolder2%\%NewFileName% ; Copy to location TWO and give new name.
FileMove, %OriginalFileName%, %MoveToFolder1%\%NewFileName% ; MOVE to location THREE and give new name. Deletes files in original location.
}
}
}