Lines 14-19
Link Here
|
14 |
############################################################################# |
14 |
############################################################################# |
15 |
|
15 |
|
16 |
use Getopt::Long; |
16 |
use Getopt::Long; |
|
|
17 |
use Switch; |
18 |
use Term::ANSIColor qw(:constants); |
17 |
use File::Basename; |
19 |
use File::Basename; |
18 |
use MLDBM qw(DB_File Storable); |
20 |
use MLDBM qw(DB_File Storable); |
19 |
use Fcntl; |
21 |
use Fcntl; |
Lines 27-32
Link Here
|
27 |
our ($root_node, $filesystem_id, @stats); |
29 |
our ($root_node, $filesystem_id, @stats); |
28 |
our ($opt_help, $opt_version, $opt_textdepth, $opt_hidesize, $opt_showdate, $opt_nosort, $opt_quiet); |
30 |
our ($opt_help, $opt_version, $opt_textdepth, $opt_hidesize, $opt_showdate, $opt_nosort, $opt_quiet); |
29 |
our ($opt_savefile, $opt_loadfile, $opt_desc, $opt_collate); |
31 |
our ($opt_savefile, $opt_loadfile, $opt_desc, $opt_collate); |
|
|
32 |
our ($opt_nocolor); |
30 |
our ($opt_files, $opt_onefilesystem, $opt_collapsepath, $opt_excludepath, $opt_coalescefiles); |
33 |
our ($opt_files, $opt_onefilesystem, $opt_collapsepath, $opt_excludepath, $opt_coalescefiles); |
31 |
our ($root_dir, $file_count, $dir_count, $next_id); |
34 |
our ($root_dir, $file_count, $dir_count, $next_id); |
32 |
our ($TYPE_FILE, $TYPE_DIR, $TYPE_EMPTY, $TYPE_COALESCED, $TYPE_COLLAPSED); |
35 |
our ($TYPE_FILE, $TYPE_DIR, $TYPE_EMPTY, $TYPE_COALESCED, $TYPE_COLLAPSED); |
Lines 56-61
Link Here
|
56 |
"d|desc=s" => \$opt_desc, |
59 |
"d|desc=s" => \$opt_desc, |
57 |
"c|collate=s" => \$opt_collate, |
60 |
"c|collate=s" => \$opt_collate, |
58 |
|
61 |
|
|
|
62 |
"nc|nocolor" => \$opt_nocolor, |
63 |
|
59 |
"f|files" => \$opt_files, |
64 |
"f|files" => \$opt_files, |
60 |
"x|one-file-system" => \$opt_onefilesystem, |
65 |
"x|one-file-system" => \$opt_onefilesystem, |
61 |
"cp|collapse-path=s" => \$opt_collapsepath, |
66 |
"cp|collapse-path=s" => \$opt_collapsepath, |
Lines 331-343
Link Here
|
331 |
printf(" [%s%s] ", "#" x $numofchars, " " x (30-$numofchars)); |
336 |
printf(" [%s%s] ", "#" x $numofchars, " " x (30-$numofchars)); |
332 |
printf("%6.2f%% ", $percent); |
337 |
printf("%6.2f%% ", $percent); |
333 |
printf("%s ", shortDate($entry->{MTIME})) if $opt_showdate; |
338 |
printf("%s ", shortDate($entry->{MTIME})) if $opt_showdate; |
334 |
printf("%s%s\n", $entry->{NAME}, $entry->{TYPE} & $TYPE_DIR ? "/" : ""); |
339 |
|
|
|
340 |
printColor( $entry ) unless ( $opt_nocolor ); |
341 |
printNoColor( $entry ) if ( $opt_nocolor ); |
335 |
if($entry->{TYPE} & $TYPE_DIR) { |
342 |
if($entry->{TYPE} & $TYPE_DIR) { |
336 |
printDir($entry, $indent+1) if(!defined $opt_textdepth || ($opt_textdepth > $indent+1)); |
343 |
printDir($entry, $indent+1) if(!defined $opt_textdepth || ($opt_textdepth > $indent+1)); |
337 |
} |
344 |
} |
338 |
} |
345 |
} |
339 |
} |
346 |
} |
340 |
|
347 |
|
|
|
348 |
sub printColor { |
349 |
my $entry = shift; |
350 |
|
351 |
my @tmp = split /\./, $entry->{NAME}; |
352 |
|
353 |
if ( $entry->{TYPE} & $TYPE_DIR ) { print BLUE, BOLD, $entry->{NAME}."/\n", RESET } |
354 |
else { |
355 |
switch ($tmp[$#tmp]) { |
356 |
#executable ( brigth gree) |
357 |
case "cmd" { print BOLD, GREEN, $entry->{NAME}."\n", RESET } |
358 |
case "exe" { print BOLD, GREEN, $entry->{NAME}."\n", RESET } |
359 |
case "com" { print BOLD, GREEN, $entry->{NAME}."\n", RESET } |
360 |
case "btm" { print BOLD, GREEN, $entry->{NAME}."\n", RESET } |
361 |
case "bat" { print BOLD, GREEN, $entry->{NAME}."\n", RESET } |
362 |
case "sh" { print BOLD, GREEN, $entry->{NAME}."\n", RESET } |
363 |
case "csh" { print BOLD, GREEN, $entry->{NAME}."\n", RESET } |
364 |
|
365 |
#archieves / compressed (brigth red) |
366 |
case "tar" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
367 |
case "tgz" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
368 |
case "arj" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
369 |
case "taz" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
370 |
case "lzh" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
371 |
case "zip" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
372 |
case "z" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
373 |
case "Z" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
374 |
case "gz" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
375 |
case "bz2" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
376 |
case "tbz2" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
377 |
case "tz" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
378 |
case "deb" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
379 |
case "rpm" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
380 |
case "rar" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
381 |
case "ace" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
382 |
case "zoo" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
383 |
case "cpio" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
384 |
case "7z" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
385 |
case "rz" { print BOLD, RED, $entry->{NAME}."\n", RESET } |
386 |
|
387 |
#image formats |
388 |
case "jpg" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
389 |
case "jpeg" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
390 |
case "gif" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
391 |
case "bmp" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
392 |
case "ppm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
393 |
case "tga" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
394 |
case "xbm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
395 |
case "xpm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
396 |
case "tif" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
397 |
case "tiff" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
398 |
case "png" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
399 |
case "mng" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
400 |
case "xcf" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
401 |
case "pcx" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
402 |
case "mpg" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
403 |
case "mpeg" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
404 |
case "m2v" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
405 |
case "avi" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
406 |
case "mkv" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
407 |
case "ogm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
408 |
case "mp4" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
409 |
case "mp4v" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
410 |
case "mov" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
411 |
case "qt" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
412 |
case "wmv" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
413 |
case "asf" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
414 |
case "rm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
415 |
case "rmvb" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
416 |
case "flc" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
417 |
case "fli" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
418 |
case "gl" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
419 |
case "dl" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET } |
420 |
|
421 |
|
422 |
case "pdf" { print GREEN, $entry->{NAME}."\n", RESET } |
423 |
case "ps" { print GREEN, $entry->{NAME}."\n", RESET } |
424 |
case "txt" { print GREEN, $entry->{NAME}."\n", RESET } |
425 |
case "patch" { print GREEN, $entry->{NAME}."\n", RESET } |
426 |
case "diff" { print GREEN, $entry->{NAME}."\n", RESET } |
427 |
case "log" { print GREEN, $entry->{NAME}."\n", RESET } |
428 |
case "tex" { print GREEN, $entry->{NAME}."\n", RESET } |
429 |
case "doc" { print GREEN, $entry->{NAME}."\n", RESET } |
430 |
|
431 |
case "mp3" { print CYAN, $entry->{NAME}."\n", RESET } |
432 |
case "wav" { print CYAN, $entry->{NAME}."\n", RESET } |
433 |
case "mid" { print CYAN, $entry->{NAME}."\n", RESET } |
434 |
case "midi" { print CYAN, $entry->{NAME}."\n", RESET } |
435 |
case "au" { print CYAN, $entry->{NAME}."\n", RESET } |
436 |
case "ogg" { print CYAN, $entry->{NAME}."\n", RESET } |
437 |
case "flac" { print CYAN, $entry->{NAME}."\n", RESET } |
438 |
case "aac" { print CYAN, $entry->{NAME}."\n", RESET } |
439 |
|
440 |
else { print $entry->{NAME}."\n", RESET } |
441 |
} |
442 |
} |
443 |
} |
444 |
|
445 |
sub printNoColor { |
446 |
my $entry = shift; |
447 |
|
448 |
printf("%s%s\n", $entry->{NAME}, $entry->{TYPE} & $TYPE_DIR ? "/" : ""); |
449 |
} |
450 |
|
341 |
sub processSizeOption { |
451 |
sub processSizeOption { |
342 |
my ($size, $temp); |
452 |
my ($size, $temp); |
343 |
|
453 |
|
Lines 437-442
Link Here
|
437 |
-d, --desc=<description> give description of save file |
547 |
-d, --desc=<description> give description of save file |
438 |
-c, --collate=<dir> collate save files in dir for web report |
548 |
-c, --collate=<dir> collate save files in dir for web report |
439 |
|
549 |
|
|
|
550 |
Color Option: |
551 |
-nc, --nocolor no color output |
552 |
By default durep color outpu |
440 |
Inclusion Options: |
553 |
Inclusion Options: |
441 |
-f, --files do not descend into subdirs, only report files |
554 |
-f, --files do not descend into subdirs, only report files |
442 |
-x, --one-file-system do not traverse file systems |
555 |
-x, --one-file-system do not traverse file systems |