I am trying to delete log files older than 2 days recursively from a root folder. I wrote what I though would work but it also deletes folders if they are also older than 2 days. Can I modify this script to accomplish my goal of just purging files?, or is there a better way to skin this cat?
set destinationDir=\\sqlbackupslas\SQLDataBackup\TESTING\CTM-A-Server
pushd %destinationDir%
echo "Deleting files from "%destinationDir%
ForFiles /s /d -2 /c "cmd /c echo "deleting..." & echo @file" <-- this is for testing, I'll change it to a delete
popd