Deletion of files within folders in root folder
Hey everyone,
I'm a volunteer tech at the local community radio station. We have a system that automatically publishes recorded shows online. It keeps them online for 4 weeks, and then removes the references to these older shows to make room for new ones.
But only the references on the webpage are removed--the audio files themselves stay on the web server.
The publishing software works in a hierarchy to upload files. Every program has a unique ID, and a new episode of the program is uploaded to a folder with the ID for that program.
So the root folder of the FTP account for this program looks like this. A bunch of folders with ID numbers for each show that the station has:
<invalid hyperlink removed by admin>
And this is a look inside one of those folders:
<invalid hyperlink removed by admin>
I'd like to automatically remove these files when they are 35 days or older. Using a WinSCP example from StackOverflow, I tried accomplishing deletion of these files with the following batch script:
Unfortunately, this code does not seem to look inside the various folders, but only acts on the root directory. It does delete folders and files inside the root directory that are older than 35 days, but that's not of great help because most shows have one or more new episodes every week. That would update the folder's date, and render this code useless.
I've tried searching Google and this website for clues on how to do recursive deletion, but I can't get the obvious wildcards like *.* to work properly with rm and the <35D mask. Maybe rm is the wrong tool for the job, maybe the mask doesn't work for this particular situation... but I don't know where to look any more.
If you could help me solve this puzzle, that'd be greatly appreciated.
Thanks in advance, also on behalf of the more than 90 volunteers of our station!
Cheers,
Daan Berg
I'm a volunteer tech at the local community radio station. We have a system that automatically publishes recorded shows online. It keeps them online for 4 weeks, and then removes the references to these older shows to make room for new ones.
But only the references on the webpage are removed--the audio files themselves stay on the web server.
The publishing software works in a hierarchy to upload files. Every program has a unique ID, and a new episode of the program is uploaded to a folder with the ID for that program.
So the root folder of the FTP account for this program looks like this. A bunch of folders with ID numbers for each show that the station has:
<invalid hyperlink removed by admin>
And this is a look inside one of those folders:
<invalid hyperlink removed by admin>
I'd like to automatically remove these files when they are 35 days or older. Using a WinSCP example from StackOverflow, I tried accomplishing deletion of these files with the following batch script:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /log=C:\Users\omitted\Documents\webdelete.log /command ^ "open ftp://omitted" ^ "rm /*<35D" ^ "exit"
I've tried searching Google and this website for clues on how to do recursive deletion, but I can't get the obvious wildcards like *.* to work properly with rm and the <35D mask. Maybe rm is the wrong tool for the job, maybe the mask doesn't work for this particular situation... but I don't know where to look any more.
If you could help me solve this puzzle, that'd be greatly appreciated.
Thanks in advance, also on behalf of the more than 90 volunteers of our station!
Cheers,
Daan Berg