=================================================================== RCS file: /cvs/wpscripts/zlist/zlist,v retrieving revision 1.2 retrieving revision 1.5 diff -u -r1.2 -r1.5 --- wpscripts/zlist/zlist 2011/07/19 16:12:10 1.2 +++ wpscripts/zlist/zlist 2011/07/19 20:23:44 1.5 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: zlist,v 1.2 2011/07/19 16:12:10 yason Exp $ +# $Id: zlist,v 1.5 2011/07/19 20:23:44 yason Exp $ use DBI; use Term::ANSIColor qw(:constants); use Time::HiRes qw(gettimeofday tv_interval); @@ -136,19 +136,20 @@ } while( index($path[$i], ' ', 0) != -1 ); - $searchpath = substr($path[$i], 23); + # remove first 13 symbols in SMB path (\\fileserver\) + $searchpath = substr($path[$i], 13); # hardcoded - $path[$i] = substr($path[$i], 30) if ($type_file == 0); - $path[$i] = substr($path[$i], 34) if ($type_file == 1); - $path[$i] = substr($path[$i], 34) if ($type_file == 2); + # remove first symbols to get only filename (i.e. \\fileserver\zayavki\ - 20 symbols) + $path[$i] = substr($path[$i], 21) if ($type_file == 0); +# $path[$i] = substr($path[$i], 34) if ($type_file == 1); +# $path[$i] = substr($path[$i], 34) if ($type_file == 2); # make local file path - $searchpath =~ tr/\\/\//; $searchpath = '/WIDEPRINT/' . $searchpath; - -# # follow symlink to achieve real path -# chomp( $_ = `dirname $searchpath | xargs /usr/bin/readlink` ); chomp( $searchpath = $_ . '/' . `basename $searchpath` ); - + $searchpath =~ tr/\\/\//; + $searchpath = '/mnt/maket/' . $searchpath; + + # finally, get file size $size[$i] = -s $searchpath; $size[$i] = ($size[$i] > 1048576 ? int($size[$i] / 1024 / 1024) . " MB" : int($size[$i] / 1024) . " KB");