Here is what I want to do: search a folder for any files modified prior to the current month and move them to another folder (essentially creating an archive folder for prior month's files. Here is the script I wrote, but it doesn't seem to work as I envisioned as it seems to be moving all files regardless of the date. For example, I was trying to move files prior to August 2020, and it copied files in August 2020. Any help would be greatly appreciated.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
Gosub, CheckBatch
SetTimer, CheckBatch, 100
CheckBatch:
{
Folder = C:\PROCESSED ; SOURCE FOLDER
Folder1 = C:\PROCESSED\Previous month's history ; DESTINATION FOLDER
FILEDATE = 20200801000000
FILEDATETEST = FILEDATE
Loop, Files, %Folder%\*.*, F
FILEDATETEST += A_LoopFileTimeModified
If FILEDATETEST < FILEDATE
FileMove, %Folder%\*.*, %Folder1%\*.*
}
return
Chris70