On 03/15/04 14:24, Norman Zhang wrote:I've /share_folder with many user folders.
e.g.,
/share_folder/user_a /share_folder/user_b ...
I would like to scan all user folders for files that are older than 30 days and delete them. Is this doable with Perl?
What do you mean by "older than 30 days"?
I mean files that were created 30 days ago. I disabled atime on my share_folder/ partition for faster access.
/dev/scsi/host0/bus1/target2/lun0/part1 /usrswap xfs rw,noatime,usrquota,grpquota 0 0
Thus, is it safe to assume the following script won't work?
You can only base it on properties stored by the filesystem. Maybe -mtime (last modified time) is close enough?
Is there a specific reason you're using perl for this task? You can accomplish the same with:
find /share_folder -mtime +30 | xargs rm
but you should probably verify the correctness of the command first with
find /share_folder -mtime +30 | xargs ls
Thank you so much. Your simple script does pretty much what I needed. However, find doesn't seem to be able to traverse sub folders with spaces in between.
[EMAIL PROTECTED] transfer]# find nzhang/ -mtime +30 | xargs ls ls: nzhang/arkon: No such file or directory
[EMAIL PROTECTED] transfer]# ls -l nzhang total 8916 drwxrwxrwx 2 nzhang Domain Users 4096 Feb 11 13:27 arkon icon/
Is there a way that I can go around this? Perhaps I need Perl for the more advance searching?
Best Regards, Norman
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>