The single line of code below will delete files over seven days old. Additionally, it runs without the Windows Command Shell opening.
The only configuration required is the path to the directory, i.e., C:\PROGRA~1\ABC\Data\Archive. Long file names (C:\Program Files\ABC\Data\Archive) work, as well.
To review additional options for "forfiles," Google is your friend.
The only configuration required is the path to the directory, i.e., C:\PROGRA~1\ABC\Data\Archive. Long file names (C:\Program Files\ABC\Data\Archive) work, as well.
To review additional options for "forfiles," Google is your friend.
[ autoit ]
Run(@ComSpec & " /c " & "forfiles /p ""C:\PROGRA~1\ABC\Data\Archive"" /s /m *.* /c ""cmd /c Del @path"" /d -7", @SystemDir, @SW_HIDE)