in reply to Re^3: removing files with perl based on age and name
in thread removing files with perl based on age and name
They think everything should be in perl itself and think that pure perl can take them to the other side.
Untrue--there are numerous articles where people suggested just using a command line operation instead of writing a perl script. I've done so a few times myself.
We have a unix system and should recognize the power of that OS which has been there since 30 years ago. What is the problem there in shipping out something to shell when the work gets done easily.
Many of us here are Unix-centric and have no problem shelling out for some tasks. But the way I read the situation is more like this:
Hippo: Why are you using the cutting blade of your swiss-army knife to remove that screw? You know it has a couple screwdriver blades, right?
gurpreetsingh13: That's the problem I have with you guys...knife blades are perfectly capable of opening paint cans, removing screws, driving nails. You don't need all those other fancy attachments.
Hmmm ... okay. Or maybe a better analogy might be this:
Hippo: You're trying to drive a nail with a chainsaw. Are you sure you really need the chainsaw to be running while you're doing that? Seems a bit iffy.
gurpreetsingh13: But chainsaws are powerful tools! Why not use them?
But ... the blood ... the detached limbs ... possible severed heads ...
But since this code is workable (tested few times on my home directory), so I had to put that rm -rf there.
Just because you tested it in your home directory, doesn't make it require -rf. But I'm guessing you didn't test it in your home directory, unless you (a) just created a brand-new virtual machine to run it under, (b) just created a new account to run it under, (c) had spaces in the names of all your important files and directory names, or (d) didn't have any important files anyway.
This is a simple script and we can forget about execution speed here.Any intelligent guy would never run the script without reading the code.
True, instead he'd delete the script and then run away screaming. That's a pretty scary script to have on your system. If you happened to be in the wrong directory and ran it, your first clue to a problem might be something like:
bash: stat: command not foundshowing up after a couple minutes of disk thrashing. Since it helpfully provides -r, it could merrily wreak havok on the filesystem ... at least until enough programs died that the script would fail.
While I agree that shelling out to other programs to solve a problem is fine, it pains me to see:
hippo raised a couple issues with the script, but your dismissal of those issues is rather peremptory.
Update: A couple fixes: s/amputations/limbs/, changed a ? to a !.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: removing files with perl based on age and name
by Laurent_R (Canon) on Jul 18, 2014 at 21:45 UTC | |
|
Re^5: removing files with perl based on age and name
by 1s44c (Scribe) on Jul 19, 2014 at 04:10 UTC |