Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Re: remove backups

by Sidhekin (Priest)
on Nov 05, 2002 at 12:07 UTC ( #210435=note: print w/replies, xml ) Need Help??

in reply to Re: remove backups
in thread remove backups

... chomp $dirname - why?

To get rid of that pesky newline. (Yes, there is one.)

... define the scalar $dirname - why?

That he may print it (in the last line)?

... use a system call to rm, making it platform dependant. Why not use unlink?

Opening "ls *~|" already makes it platform dependent. Of course, that could be glob("*~"), so your question still stands ...

... empty the entire directory from which this is run - why not use rm * | del *.* | whatever?

I think you miss the point: the alternative would be rm *~, which is quite easy to get wrong. Or at least easy enough to make guys like me paranoid.

Me, I have a bash function for this sort of thing:

function cleanup { rm "$@" *~ .*~ #* }

If it ever gets complicated enough that I make a Perl script out of it, I'll probably make it platform independant. For now, it does the job.

The Sidhekin
print "Just another Perl ${\(trickster and hacker)},"

Replies are listed 'Best First'.
Re: Re: Re: remove backups
by smitz (Chaplain) on Nov 05, 2002 at 12:16 UTC
    Undeserved Abbots are quick to reply, slow to think. Of course pwd is a command, not a directory name. The backticks should have given it away, but its one of those days|weeks|lives.
    Apologies to pfm, you know where the -- button is...


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-11-29 01:11 GMT
Find Nodes?
    Voting Booth?