Delete File Older Than X Days

Tags: DOS, files, command shell

ForFiles /p "C:\path\to\folder" /s /d -30 /c "cmd /c del @file"

1 Comment

  • researchadmin said Reply

    ForFiles command breakdown
    /p — indicates the pathname to start searching.
    /s — instructs ForFiles to search inside subdirectories.
    /d — specifies the last modified date for a file.
    /c — instructs ForFiles to execute command, which needs to be wrapped in double-quotes, the default is "cmd /c del @file"

You must log on to comment.