User Tools

Site Tools


auto_unrar_perl_version

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
auto_unrar_perl_version [2009/09/20 04:07] – created jtauto_unrar_perl_version [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-The bash version had limitiatons, with perl I can implement with better logic for rar handling. WIP.  
  
-<code perl> 
-#!/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 
-# ) 
-# } 
-# 
-# 
-#} 
-</code> 
auto_unrar_perl_version.1253419629.txt.gz · Last modified: 2020/08/10 02:28 (external edit)