Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How do you list all files under a directory?

by superfrink (Curate)
on Sep 22, 2010 at 18:25 UTC ( #861333=note: print w/replies, xml ) Need Help??


in reply to How do you list all files under a directory?

Here is some code to find emacs ~ files and delete them.
#!/usr/bin/perl -w use strict; use File::Finder; use Data::Dumper; # list of dirs to look in my @start_dirs = ( '/home/chad/' , ); my $finder = File::Finder # do not go into the ~chad/Archives/ directory. ->type('d')->name('Archives')->prune->comma # match the following properties. ->type('f') # files ->name('*~') # named glob(*~) ->ctime('+6') # inode changed time more than 6 days ago # ->ls() # print `ls -l` of file ; # run the finder command now. my @file_list = $finder->in(@start_dirs); # delete the found files. my $count = unlink @file_list; print "\nUnlinked $count files.\n"; exit(0);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://861333]
help
Chatterbox?
[Discipulus]: yes, some semantic for the searxh must implemented before using such kind of query
[Corion]: Yeah - I have either to come up with a better search query or simply steal the template of some other file download site... I'm thinking of turning the JSON for Strawberry Perl releases into a small website that offers the files for download, with a ...
[Corion]: ... separate page per release, and potentially RSS for the versions

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2017-02-28 08:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (398 votes). Check out past polls.