Skip to content

Instantly share code, notes, and snippets.

@abdmun8
Last active May 26, 2022 16:56
Show Gist options
  • Select an option

  • Save abdmun8/a3a0e26ed0fc988efd3c7b8d04dc2876 to your computer and use it in GitHub Desktop.

Select an option

Save abdmun8/a3a0e26ed0fc988efd3c7b8d04dc2876 to your computer and use it in GitHub Desktop.

Revisions

  1. abdmun8 revised this gist May 26, 2022. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions delete-files-older-than-7-days.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,10 @@
    ```cmd
    ForFiles /p "C:\path\to\folder" /s /d -7 /c "cmd /c del /q @file"
    ```
    or
    ```cmd
    ForFiles -p "C:\path\to\folder" -s -m *.bak -d -7 -c "Cmd /C del @FILE"
    ```

    ### Add do task scheduler
    - Go to action tab
  2. abdmun8 created this gist Jan 8, 2022.
    11 changes: 11 additions & 0 deletions delete-files-older-than-7-days.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    ### Delete Files older than 7 days on windows

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

    ### Add do task scheduler
    - Go to action tab
    - On program/script input insert `ForFiles`
    - On argument input paste the rest of the command
    - Save