I'm trying to make a batch file to run from the Task Scheduler that will clean up some residual files left from a programme that converts video.
At the moment I have:
:: begin the script --> start in UNC path PushD "\\UNC\ShareDrive\" &&( :: clear the log file every 30 days Forfiles -m *.log -d -30 -c "cmd /c BREAK>mbWatchfoldersCleanup.log" :: delete *wav, *.mov, *.mp4 files older :: than 7 days and add to the log file for %G in (.wav, .mov, .mp4) do Forfiles -s -m *%G -d -7 -c "cmd /c del /Q /S @path >> mbWatchfoldersCleanup.log" ) & PopD
My intention is to have the
Forfiles to run from the UNC path.
But I also would like it to match and search specific folders (haven't figured out how to do that).
What occurs in the video conversion is, once the MOV and the WAV file have been muxed, it deletes the MOV file, and moves the WAV into a
__completed folder. If the file fails to mux, both MOV and WAV are moved into
I'd like the
cmd /c del /Q /S @path to search only folders matching the
__completed and the
__failed then delete any matching filetypes.
I am running into issues where the folders appear multiple times within the share:
\\UNC\ShareDrive\ -- username01 ----__converting ----__completed ----__failed -- username02 ----__converting ----__completed ----__failed -- username03 ----__converting ----__completed ----__failed
Is this something possible to be altered and have it delete only within the selected folders? Or is it something that should be run on two scripts?