Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How can I delete files useing Perl

Reply
Thread Tools

How can I delete files useing Perl

 
 
moneytea
Guest
Posts: n/a
 
      07-19-2003
Hi,
I am a newbie,I try to use this programs to delete files(OS is Linux)
----------------------------------------
# file DEL.pl
#!/usr/bin/perl
$readparse;
print "Content-type: text/html\n\n";
unlink "del_file";
----------------------------------------
I can execute this program in command line ( ./DEL.pl) then it works .and
the file "del_file"
was removed ,but when I put "DEL.pl" into the /usr/local/apache/cgi-bin/ ,It
do nothing.
I really do not understand.
I even try this : system ("rm -rf del_file") ,not work too!
this program has the popedom of root.
Can anyone help me ?
thanks


 
Reply With Quote
 
 
 
 
Tintin
Guest
Posts: n/a
 
      07-19-2003

"moneytea" <> wrote in message
news:bfb2kd$271k$...
> Hi,
> I am a newbie,I try to use this programs to delete files(OS is Linux)
> ----------------------------------------
> # file DEL.pl
> #!/usr/bin/perl
> $readparse;
> print "Content-type: text/html\n\n";
> unlink "del_file";
> ----------------------------------------
> I can execute this program in command line ( ./DEL.pl) then it works .and
> the file "del_file"
> was removed ,but when I put "DEL.pl" into the /usr/local/apache/cgi-bin/

,It
> do nothing.


Oh but it will do something if you inspect the reason it "do nothing", ie:

unlink "del_file" or die "Could not delete del_file because $!\n";

and I'm willing to say with 99% certainity that the reason will be "No such
file or directory"


 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      07-19-2003
moneytea wrote:
[...]
> I can execute this program in command line ( ./DEL.pl) then it works
> .and the file "del_file"
> was removed ,but when I put "DEL.pl" into the
> /usr/local/apache/cgi-bin/ ,It do nothing.
> I really do not understand.
> I even try this : system ("rm -rf del_file") ,not work too!
> this program has the popedom of root.
> Can anyone help me ?


Please see "perldoc -q 500".
Although that FAQ seems to answer a different question, the answer applies
in your case, too.

jue


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
FAQ 5.38 Why does Perl let me delete read-only files? Why does "-i" clobber protected files? Isn't this a bug in Perl? PerlFAQ Server Perl Misc 0 02-11-2011 05:00 AM
Ruby apps useing multiple files Nigel Wilkinson Ruby 5 09-29-2006 09:33 AM
Useing Perl With C to Read From Executable Nori Perl Misc 5 05-15-2006 09:40 PM
How can we add useing clause in Globa.asas ad ASP .Net 1 07-03-2005 02:12 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57