Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Delete Files Older Than with One Line of Code

$
0
0
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.

[ autoit ]      
Run(@ComSpec & " /c " & "forfiles /p ""C:\PROGRA~1\ABC\Data\Archive"" /s /m *.* /c ""cmd /c Del @path"" /d -7", @SystemDir, @SW_HIDE)

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>