Automic Workload Automation

 View Only

  • 1.  Deleting old files using scripting

    Posted Jul 19, 2022 05:16 PM
    Hi All,

    we have a requirement on deleting some old files (.TXT) from the agent(Windows) by running some jobs. we used to do this manually but now we need a job that can be executed every month and delete these old files.
    Has anyone done it before? Can anyone provide us the script for this?

    Regards,
    Shravan Shetty


  • 2.  RE: Deleting old files using scripting

    Posted Jul 20, 2022 01:44 AM
    Hi Shravan,

    We had done the same thing for Linux & AIX OS in our environment by using  a shell script.

    Logic is very staright forward.
    cd to folder where file resides and then look for the files older then n days (n is number of days) and run the delete command against to them.


  • 3.  RE: Deleting old files using scripting

    Posted Jul 20, 2022 01:59 AM
    A 10 seconds search...

    https://www.google.com/search?q=windows+delete+files+older+than+x+day

    ...brought me here:

    ForFiles /p "C:\Automic\Automic\temp\test" /s /d -30 /c "cmd /c del @file"

    ------------------------------
    ----------------------------------------------------------------
    Automic AE Consultant and Trainer since 2000
    ----------------------------------------------------------------
    ------------------------------