Hi

But i don't know how to make it to search in every folder.
One of the ways of doing that, is using either a recursive subroutine, or use File::Find module.
Using a recursive subroutine:
For Example: To list out all the files in different folders in a directory like so:

use warnings; use strict; scan_dir( $ARGV[0] ); ## call subroutine sub scan_dir { my ($dir) = @_; if ( -d $dir ) { ## check if directory opendir my $dh, $dir or die "can't open directory: $!"; while ( readdir $dh ) { next if $_ eq '.' or $_ eq '..'; print $_, $/; scan_dir("$dir/$_"); ## recursive call } } }
This can even get simplier using a File::Find module like so:
use warnings; use strict; use File::Find qw(find); find(\&scan_dir,$ARGV[0]); sub scan_dir{ return if $_ eq '.' or $_ eq '..'; print $_,$/; }
NOTE:Please, that the codes above is to show how you can transverse a dircetory. To get your rar files, and "unrar", is left for you to figure out. Am sure you will get around it! :)
Check perldoc File::Find for more info.
Cheers.


In reply to Re: unrar from multiple directories by 2teez
in thread unrar from multiple directories by cesapun

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.