View Full Version : Timed deletion of orphan files
Not sure if this is possible, but I do not want to delete my orphans right away, but only if they are orphaned longer than (let's say 30 days). I don't want this to be based on the file date, but an 'orphan' date. Any possibilities to handle this?
Thanks
Craig
12-Feb-2004, 09:53 AM
I don't think so. The cutoff always looks at the last modified time of the files. If we were to include anything more complex (like you're describing), we would need to keep track of the comparison results between runs. That's on the wishlist, but it's a pretty big feature, so I don't think we'll get to it soon.
jdmarch
12-Feb-2004, 11:27 AM
I suggest a 1-line alias or batch file running underJP Software (http://www.jpsoft.com/)'s 4NT or Take Command 32. I think that the following command, with 3 parameters (source dir, target dir, # days) would do it for you:
if %#=3 for /[d-%3,1/1/80]/a:-d %f in (%2\*) if not exist %1\%@filename[%f] del /p %f
So if you typed:
deloldorphans c:\source d:\target 30
It would delete all files older than 30 days in the target dir which are orphas relative to the source dir.
(The /p parameter makes the delete command prompt you for each deletion; after you are comfortable that this command acts as you desire, you can remove the /p to speed things up.)
Craig
12-Feb-2004, 11:35 AM
I may be wrong, but I don't think that's what anonymous was asking for. It sounds like he wants to delete files that have been orphans for longer than 30 days, regardless of the dates of the files themselves. Like I said, that would require a record of what the comparison was like for the last 30 days, which BC doesn't support.
If you just want to delete orphaned files that are more than 30 days old (based on the last modified date), BC can do that:
load C:\source D:\target
filter cutoff:>30
select right.orphans
delete right
jdmarch
12-Feb-2004, 12:59 PM
Craig, that makes sense on both counts. Of course BC can do (and more easily) the same job as the JPSoft batch file which I suggested, and of course that's not what Anon seems to be looking for. Sorry for adding confusion into the mix.
Logically, the only way to do what Anon seems to want, is to run a synch procedure frequently, which would record into an "orphans list file" the date on which each file is first observed to be orphaned, would remove files from this list if they were no longer orphaned, and would delete orphaned files after the specified interval. FWIW, one could write a JPSoft batch file to do this, but it would be a bit longer and trickier than the one which I suggested above.
Thanks guys .. Craig .. you were on mark with my request.
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.