auto_unrar_perl_version
This is an old revision of the document!
The bash version had limitiatons, with perl I can implement with better logic for rar handling. WIP.
#!/usr/bin/perl -w use strict; use File::Touch; use File::Find; ##Jason Thomas ##20090920 ### need to implement directory and rar file hash table use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; my $rarCmd = "rar -o+ -idp e"; my $rarSwitch = "-o+ -idp e"; my $imagesDir = "/media/harddisk3/home/jason/images2"; my @rarFileList; ##find({wanted => \&wanted}, $imagesDir); find(\&wanted, $imagesDir); extractRar(); ##print @rarFileList; exit; sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); if (/^.*\.rar\z/s &&(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && (int(-C _) < 1)){ push (@rarFileList,$dir); } } sub extractRar{ foreach (@rarFileList){ chdir $_; if (! -e ".rarcc"){ if (-e glob "*.rar"){ system ("$rarCmd *.rar"); touch ('.rarcc'); } elsif(-e glob "*part01.rar") { system ("$rarCmd *part01.rar"); touch ('.rarcc'); } else{ touch ('.rarcc'); ##print "nothing to extract in $_"; } } } } #sub extractRar2{ # # foreach (@rarFileList){ # my $rarArchive = new Archive::Rar(); # print $_; # $rarArchive -> Extract( # -archive => $_, # -quiet # ) # } # # #}
auto_unrar_perl_version.1253419629.txt.gz ยท Last modified: 2020/08/10 02:28 (external edit)