Jump to content

Recommended Posts

Posted

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.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...