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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get the file size using readdir 1

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
Trying to get the file size using readdir with e following code (taken from some perl manual),but without any luck:

opendir DH,"$tempdir" or die "Could not open $tempdir !\n";
while ($_ = readdir (DH)) {
next unless (/$targetfile/);
$currentSize = print -s _;
}

will appreciate advise.
(I know that line "$currentSize = print -s _" is wrong ...)

Long live king Moshiach !
 
Code:
while ($_ = readdir (DH)) {
    next unless (/$targetfile/);
    $currentSize = -s $_;
    print $currentSize ;
}

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top