On 03/15/04 17:34, Norman Zhang wrote:
Randy W. Sims wrote:

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?

I don't know any way to make it work with filenames containing spaces (filenames with spaces are generally a bad idea, even on Windows). You'll probably need to use either File::Find or walk the directories manually (with opendir, readdir, closedir). You can still use the find2perl utility to generate the code for you if File::Find will work for you. Alternatively, the script John posted should work fine for your needs.


Randy.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to