Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file utilities in Perl without using command.com

Status
Not open for further replies.

BKtechie

MIS
Mar 27, 2002
132
US
Hi,
I'm attempting to get a perl script to work on Win98. Unfortunately, when I make calls to the system, it bombs out. Are there utilities that will erase files available without calling the command prompt? Any ideas would be much appriciated.

BKtechie
 
Have a look at for descriptions of [tt]unlink()[/tt] and other file functions. Your distribtion should include equivalent documentation.

Yours,

fish

"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilkes
 
Are you talking about erasing or deleting?

--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
You might also be interested in File::path [1], which is part of the Perl core, so is already installed when you install Perl.

[1]
Although concerned with directories not files, you can reap a whole directory structure (include all files and subdirectories) with rmtree() and create all the directories in a single path with mkpath(). Very useful app.

Barbie
Leader of Birmingham Perl Mongers
 
#here's the code I'm converting to win98 from XP:
use warnings;
use strict;
my $temp;
my @files = glob("o:\\internet\\*.txt");
for $_ (@files){
print "Email: $_ \n";
# call DOS sendmail app (I'm sure I can pipe to the app
# instead)
$temp = system("c:/sendmail/sendmail -t -messagefile=$_");
if ($temp==0){
# delete the file in question
system("del $_");
}
}
# delete these unused files from this dir, cannot remove the
# dir b/c of other files stored here.
system("del o:\\internet\\*.wrk");
system("del o:\\internet\\*.tmp");

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top