system("clear"); if($ARGV[0] eq "" || $ARGV[0] eq "--help" || $ARGV[0] eq "?" || $ARGV[ +0] eq "-h") { usage(); exit; } if($ARGV[1] eq "" || $ARGV[1] eq "--help" || $ARGV[1] eq "?" || $ARGV[ +1] eq "-h") { usage(); exit; } if($ARGV[2] eq "" || $ARGV[2] eq "--help" || $ARGV[2] eq "?" || $ARGV[ +2] eq "-h") { usage(); exit; } $path = $ARGV[0]; $outputf = $ARGV[1]; $get_subs = $ARGV[2]; open(OUT, ">".$outputf); ##Open Output getfiles($path, $get_subs); close(OUT); exit; ###Sub Routines sub getfiles { my ($path, @files, $fname, $get_subs); $path = @_[0]; $get_subs = @_[1]; opendir(DIR,$path); @files = readdir(DIR); closedir(DIR); $ct = 0; foreach $fname (@files) { my ($full_path, $c_full_path, $p_full_path, $dir_full_path); $full_path = sprintf("%s%s", $path, $fname); $c_full_path .= $path . "."; $p_full_path .= $path . ".."; # print "\n\nSTART:\nFULL PATH: $full_path\n"; # print "\nC_FULL PATH: $c_full_path\n"; # print "P_FULL PATH: $p_full_path\n"; # print "\nOriginal Path: $path\nOrig Fname: $fname\n"; # print "New Path: $path\nNew Fname: $new_fname\n\n"; if($full_path eq $c_full_path) { print "Skip \"CUR:$full_path\"\n" +; next; } # skip cur dir if($full_path eq $p_full_path) { print "Skip \"PAR:$full_path\"\n" +; next; } # skip par dir ($new_path, $new_fname) = &changename($path, $fname, $outputf); if($get_subs eq "1") { if(-d $full_path) # dir find { $dir_full_path .= $full_path . "/"; # print "\nDIRECTORY: $full_path\n"; # print "DIREC: $dir_full_path\n"; getfiles($dir_full_path); next; } } } } sub changename { my ($path, $fname, $new_path, $new_fname, $full_path, $new_full_path +); my ($full_path, $c_full_path, $p_full_path); $path = @_[0]; $fname = @_[1]; $full_path = sprintf("%s%s", $path, $fname); $new_fname = lc($fname); $new_full_path = sprintf("%s%s", $path, $new_fname); #print "\n\nSTART:\nFULL PATH: $full_path\n"; #print "\nC_FULL PATH: $c_full_path\n"; #print "P_FULL PATH: $p_full_path\n"; #print "\nOriginal Path: $path\nOrig Fname: $fname\n"; #print "New Path: $path\nNew Fname: $new_fname\n\n"; rename($full_path, $new_full_path); { print OUT "C: \"$full_path\" -> \"$new_full_path\"\n"; } } sub usage { print << 'EOT'; SYNTAX: perl case.pl path outputf subs USAGE: Take a directory/sub dir and convert all caps/single to lowerca +se Notes: 1. files/subs either "0" or "1" -0 = current files in direc -1 = all current file and file in subdirs ex "./case.pl /home/joeh out 1" EOT } --Thankx for all u'r Help --Joe

In reply to Re: Renaming Sub Dir/Files. by Anonymous Monk
in thread Renaming Sub Dir/Files. by JoeCool

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.