Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Create a list of directories without . and ..

by vladb (Vicar)
on Jun 04, 2002 at 18:36 UTC ( [id://171596]=note: print w/replies, xml ) Need Help??


in reply to Create a list of directories without . and ..

There's a pretty quick and dirty way to do it. Here's how:
@a = grep(!/^.$/, `find .`); print @a;
the find . system command will return a list of all directories (and sub-directories depending on command line switches used) starting at '.' (your current directory). By default, it will also return '.' as one item of the list. Here, you simply weed it out with a grep ;).

_____________________
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print" +- $1"}&&`rm $1`; print$\;}

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (1)
As of 2024-04-24 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found