File::Size

File::Size is a Perl module to get the size of files and directories.
Download

File::Size Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ofer Shaked
  • Publisher web site:
  • http://search.cpan.org/~ofer/File-Size-0.06/lib/File/Size.pm

File::Size Tags


File::Size Description

File::Size is a Perl module to get the size of files and directories. SYNOPSISGet 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:dirThe directory you want the module to get the size for it. Default is current working directory.blocksizeThe blocksize for the output of getsize() method. default is 1 (output in bytes).followsymlinksIf you want to follow symlinks for directories and files, use this option. The default is not to follow symlinks.humanreadableIf 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";setdirUsed to set (or get - if called without parameters) the directory. Example: $obj->setdir( '/etc/' );setblocksizeUsed to set (or get - if called without parameters) the block size. Example: $obj->setblocksize( 1024 );setfollowsymlinksUsed to set if you want to follow symbolic links or not. If called without parmeters, returns the current state. Example: $obj->setfollowsymlinks( 1 );sethumanreadableUsed to set (or get - if called without parameters) if you want human-readable output sizes. Example: $obj->sethumanreadable( 1 );getsizeUsed to calculate the total size of the directory. Prints output according to the block size you did or didn't specify. Requirements: · Perl


File::Size Related Software