locked
Script dos in Windows10 to delete directory older than n days wich name start with "BCK_" RRS feed

  • General discussion

  • Hi, can help me to write a dos script for windows10 to delete directory older than n days wich name start with "BCK_" ?

    I see this two command:

    1) for delete directory older 10 days

    FORFILES /S /D -10 /C "cmd /c IF @isdir == TRUE rd /S /Q @path"

    2) for delete directory wich start with "Test_"

    for /d %%a in (D:\Test_*) do rd %%a /q

    How I can to unique all ?

    Thanks

    • Changed type Bill_Stewart Friday, July 27, 2018 6:22 PM
    • Moved by Bill_Stewart Friday, July 27, 2018 6:23 PM Unanswerable drive-by question
    Thursday, April 26, 2018 1:46 PM

All replies

  • There is no such thing as a "dos script". DOS is an obsolete operating system.

    There is cmd.exe, but we don't recommend it anymore now that we have PowerShell.

    With PowerShell, things like this are pretty straightforward once you learn the basics.


    -- Bill Stewart [Bill_Stewart]

    Thursday, April 26, 2018 2:16 PM