How can I delete files useing Perl

Discussion in 'Perl Misc' started by moneytea, Jul 19, 2003.

  1. moneytea

    moneytea Guest

    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
     
    moneytea, Jul 19, 2003
    #1
    1. Advertising

  2. moneytea

    Tintin Guest

    "moneytea" <> wrote in message
    news:bfb2kd$271k$99.com...
    > 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"
     
    Tintin, Jul 19, 2003
    #2
    1. Advertising

  3. 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
     
    Jürgen Exner, Jul 19, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RHJXaG8=?=

    File transfer useing <a in VB

    =?Utf-8?B?RHJXaG8=?=, May 12, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    460
    =?Utf-8?B?RHJXaG8=?=
    May 27, 2005
  2. ad
    Replies:
    1
    Views:
    539
    Karl Seguin
    Jul 3, 2005
  3. Replies:
    0
    Views:
    608
  4. Nigel Wilkinson

    Ruby apps useing multiple files

    Nigel Wilkinson, Sep 28, 2006, in forum: Ruby
    Replies:
    5
    Views:
    92
    David Roberts
    Sep 29, 2006
  5. Nori
    Replies:
    5
    Views:
    82
    Charles DeRykus
    May 15, 2006
Loading...

Share This Page