Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    File::Size 0.06

    Download button

    No screenshots available
    Downloads: 360  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Ofer Shaked | More programs
    Perl Artistic License / FREE
    April 30th, 2007, 18:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    File::Size description

    Get the size of files and directories

    SYNOPSIS

    Get the size for directory /etc/ with the block size of 1024 while following symbolic links:

    my $obj = File::Size->new(
    dir => '/etc/',
    blocksize => 1024,
    followsymlinks => 1,
    humanreadable => 1
    );
    print $obj->getsize(), "n";


    File::Size is used to get the size of files and directories.

    There are 6 methods you can use:

    new

    There are 4 optional hash values for the new() method:

    dir

    The directory you want the module to get the size for it. Default is current working directory.

    blocksize

    The blocksize for the output of getsize() method. default is 1 (output in bytes).

    followsymlinks

    If you want to follow symlinks for directories and files, use this option. The default is not to follow symlinks.

    humanreadable

    If you want output size in human readable format (e.g. 2048 -> 2.0K), set this option to 1.

    You don't have to specify any of those options, which means this is okay:
    print File::Size->new()->getsize(), " bytesn";

    This is okay too:
    print File::Size->new()->setdir( '/etc/' )->setblocksize( 1024**2 )->getsize(), " MBn";

    setdir

    Used to set (or get - if called without parameters) the directory. Example: $obj->setdir( '/etc/' );

    setblocksize

    Used to set (or get - if called without parameters) the block size. Example: $obj->setblocksize( 1024 );

    setfollowsymlinks

    Used to set if you want to follow symbolic links or not. If called without parmeters, returns the current state. Example: $obj->setfollowsymlinks( 1 );

    sethumanreadable

    Used to set (or get - if called without parameters) if you want human-readable output sizes. Example: $obj->sethumanreadable( 1 );

    getsize

    Used to calculate the total size of the directory. Prints output according to the block size you did or didn't specify.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    get file size | get directory size | Perl module | File::Size | get | file

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM