Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: ignore list of files using readdir function (grep filter)

by Anonymous Monk
on Jul 22, 2013 at 10:38 UTC ( #1045621=note: print w/ replies, xml ) Need Help??

Comment on Re: ignore list of files using readdir function (grep filter)
Re^2: ignore list of files using readdir function (grep filter)
by tbone654 (Beadle) on Jul 22, 2013 at 11:36 UTC
    Put what you want to exclude or include into a file (eg. file1) one per line... Put the output of the directory contents into file2...
    grep -i -v -f file1 file2
    similarly if you wish to "match" everthing in file1 leave off the -v
    grep -i -f file1 file2
    the -i ignores case so leave that off if you wish an exact match (case sensitive)
    grep -f file1 file2
    the first file after the -f is always the "from" file
Re^2: ignore list of files using readdir function (grep filter)
by kaka_2 (Acolyte) on Jul 23, 2013 at 07:10 UTC

    Hello There,

    I was able to use the grep in order to ignore the files with pattern

    sub GetINDirFiles { my ($path) = @_; opendir DIR, $path or die $!; my @files = readdir DIR; my @files = grep {!/\_ACK_/} readdir DIR; closedir DIR; return(@files); }
    now the problem i have is that there are around 5000 files and later when i compare these files agains another list of files, it takes too much time.

    So i was thinking is it possible to list files which are between current time to current time - 15 minute?

    Thank You. -KAKA-

      So i was thinking is it possible to list files which are between current time to current time - 15 minute?

      Yes , of course it is possible, see stat and time

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045621]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2015-07-07 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls