|Pathologically Eclectic Rubbish Lister|
Re: Need helpby ELISHEVA (Prior)
|on Oct 15, 2012 at 10:22 UTC||Need Help??|
First, welcome to the monastery, qwerty80, and to Perl.
Second, using scripts to delete files automatically when you don't know scripting is dangerous business. If there is a bug in your script you could end up deleting a LOT more than you intended. Please be careful.
"Delete these file" scripts are not good choices for beginner scripts. If there is any way you can do this manually on the command line I strongly recommend it, even if it will take more time. If you are using a pattern like "abc*.xml", first run a command to list files ( "ls" for unix, "dir" for windows). If you are getting the files you want to delete and only the files you want to delete, then carefully retype the command replacing dir/ls with a command to delete files. If you really must do this via a script, first write your script so that does nothing except print out the list of files, e.g.
Only after you are really, really sure that you are looping through the files you want to delete and nothing more, only then, should you replace the print "<$file>\n" with code to delete files. If what I've just said sounds too difficult, then again, doing this via script is not safe at all and you should really do this deletion task manually.
Third, I realize you are feeling desperate, but PerlMonks is not a coding service. We monks do not get real happy about questions like "I need a script give me one", even when one is urgently needed.
We are here to help people learn how to code in Perl, not to solve their homework or work problems for them. Our payback is the realization that we've helped someone become a slightly better coder and a slightly better coder in Perl particularly. We don't get your salary or your degree, just the satisfaction of helping someone learn.
For us to get that satisfaction the person has to show us what they want to learn, not simply ask for a solution. I think you will get a much more friendly response from people if you show the code you tried to write and to ask for help rather than say "script please?!".