Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Recursive search and delete

by tobyink (Abbot)
on Nov 16, 2012 at 13:03 UTC ( #1004182=note: print w/ replies, xml ) Need Help??


in reply to Re: Recursive search and delete
in thread Recursive search and delete

"I didn't actually let it do file deletions because I'm loath to do automatic deletes until I've well tested such a script."

One nifty trick I sometimes use in situations like that is to make my script output text like this to STDOUT:

rm ABC/JKL/abc_x.xml rm ABC/JKL/abc_y.xml rm ABC/JKL/abc_z.xml

Then when I've played with it a few times, and I'm confident it's outputting the right commands, pipe the output into sh:

perl myscript.pl | sh

This is also good if you need to do a bunch of complex database changes. Just write SQL to STDOUT, and once you're sure it's OK, pipe it into your favourite command-line SQL tool.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^2: Recursive search and delete
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2014-09-30 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (378 votes), past polls