CGI/Perl Guide | Learning Center | Forums | Advertise | Login Site Search: in Perl Guide PerlGuru Forums Learning Ctr

Home: Perl Programming Help: Intermediate:
How to Delete File from Machine

Karthik
Deleted

Dec 20, 2000, 11:37 PM

Post #1 of 5 (328 views)
 How to Delete File from Machine Can't Post
Hi Guys
Can any one tell me how to delete the file by using perl from the Machine...Is there any Function...??
Karthik K

sleuth
Enthusiast / Moderator

Dec 20, 2000, 11:41 PM

Post #2 of 5 (326 views)
 Re: How to Delete File from Machine [In reply to] Can't Post

I know the FAQ is always overlooked, but if you go Here in the FAQ You'll find the function and it's usage.

Sleuth

Karthik
Deleted

Dec 20, 2000, 11:52 PM

Post #3 of 5 (325 views)
 Re: How to Delete File from Machine [In reply to] Can't Post
thanks but it is not workin
I have a file called text.txt in the same directory in which the perl file is running. But the code has no effect. how to give with Path. the full path is "E:\perl scripts\file\text.txt"
can u help me out on this
thanks
karthik

Karthik
Deleted

Dec 20, 2000, 11:53 PM

Post #4 of 5 (325 views)
 Re: How to Delete File from Machine [In reply to] Can't Post
Sorry Pal it is Working well thanks
KArthik

japhy
Enthusiast

Dec 21, 2000, 7:02 AM

Post #5 of 5 (321 views)
 Re: How to Delete File from Machine [In reply to] Can't Post
Windows allows you to use forward slashes from programs. So you can write

 Code
unlink "E:/perl scripts/file/text.txt";
or, use single quotes:

 Code
unlink 'E:\perl scripts\file\text.txt';
You should also do error checking on the function.

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author

 Announcements     PerlGuru Announcements Perl Programming Help     Frequently Asked Questions     Beginner     Intermediate     Advanced     Regular Expressions     mod_perl     DBI     Win32 Programming Help Fun With Perl     Perl Quizzes - Learn Perl the Fun Way     Perl Golf     Perl Poetry Need a Custom or Prewritten Perl Program?     I need a program that...     I Need a Programmer for Freelance Work     Throw Down The Gauntlet General Discussions     General Questions     Feedback     Tutorial/Article Suggestions for The Learning Cent     Internet Security Other Programming Languages     Javascript     PHP

 Search this forum this category all forums for All words Any words Whole Phrase (options) Powered by Gossamer Forum v.1.2.0