Remove all files in all Sub Folders named *.trn older than 7 days
Hi Everyone,
I have the following batch script I am using to try and delete all .trn files from all subfolders of a specific directory:
When I run the script nothing is deleted and the logs show:
I have the following batch script I am using to try and delete all .trn files from all subfolders of a specific directory:
@echo off "C:\Program Files (x86)\WinSCP\WinSCP.com" ^ /log="PATH\winscp.log" /logsize=5*100M /ini=nul ^ /command ^ "open sftp://USER:PASS@SERVER/ -hostkey=""HOSTKEY""" ^ "cd /PATH TO TOP LEVEL DIRECTORY/" ^ "rm *.trn<7D" ^ "close" ^ "exit" set WINSCP_RESULT=%ERRORLEVEL% if %WINSCP_RESULT% equ 0 ( echo Success ) else ( echo Error ) exit /b %WINSCP_RESULT%
There are no .trn files in the root folder the script CD's in to, but there are many older than 7 days, 1 or more sub folders below. How can I get the script looking in all sub folders?Script: No file matching '*.trn<7D' found.