Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Byte Count

by qball (Beadle)
on Jul 17, 2001 at 20:00 UTC ( [id://97427]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

qball has asked for the wisdom of the Perl Monks concerning the following question:

Goal: Get the byte count of a document located in a given directory.

Directory Path: /opt/backup/test/

File Name: databyqball

End Results: Return the byte count of databyqball.

Any suggestions are greatly appreciated.
Thanks!

qball~"I have node idea?!"

Replies are listed 'Best First'.
Re: Byte Count
by HyperZonk (Friar) on Jul 17, 2001 at 20:02 UTC
Re: Byte Count
by lhoward (Vicar) on Jul 17, 2001 at 20:03 UTC
    my $size = -s "/opt/backup/test/databyqball";
Re: Byte Count
by converter (Priest) on Jul 17, 2001 at 20:16 UTC

    Obligatory reminder: -X tests set $! and return undef if the file doesn't exist (and presumably on other system errors, although I haven't tested).

    $filesize = -s $filespec; die "error: $!" unless defined $filesize;

    conv

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://97427]
Approved by root
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.