Friday, July 1, 2011

If a file exists in Perl

 #!/usr/bin/perl -w

$filename = '/path/to/your/file.doc';
if (-e $filename) {
print "File Exists!";
 Also get the file size:
 #!/usr/bin/perl -w

$filename = '/path/to/your/file.doc';
$filesize = -s $filename;
print $filesize;
 

0 comments:

Post a Comment