Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: How to rename the files its directory structure using perl?

by finddata (Sexton)
on Mar 15, 2017 at 06:12 UTC ( #1184646=note: print w/replies, xml ) Need Help??


in reply to Re: How to rename the files its directory structure using perl?
in thread How to rename the files its directory structure using perl?

following error: main::runDir() called too early to check prototype at ./generate.pl line 296.
  • Comment on Re^2: How to rename the files its directory structure using perl?

Replies are listed 'Best First'.
Re^3: How to rename the files its directory structure using perl?
by huck (Parson) on Mar 15, 2017 at 06:20 UTC

    kill the prototypes!!!!!!!!!!! change this

    sub runDir($$); sub runDir($$) {
    to this
    sub runDir {
    you dont know what they are doing anyway

Re^3: How to rename the files its directory structure using perl?
by huck (Parson) on Mar 15, 2017 at 06:26 UTC

    ok changed my mind too run this

    sub runDir { my $prefix = shift @_; print '*'.$prefix,"\n"; my $dir = shift @_; print "**$dir*","\n"; opendir(DIR, $dir) or die $!; my @entries = readdir(DIR); # print @entries,"\n"; close(DIR); foreach my $file (@entries) { next if ($file =~ /^\.+$/); if ( -d $dir . '/' . $file) { print '***down runDir -- '.$prefix . $file . '_'.','. $dir + . '/' . $file."\n"; runDir($prefix . $file . '_', $dir . '/' . $file); print '***up runDir -- '.$prefix . $file . '_'.','. $dir +. '/' . $file."\n"; } elsif ( ( -f $dir . '/' . $file ) && ( $file =~ /\.config$/ +) && ($file !~ /^$prefix/)) { my $suffix = $file; $suffix =~ s/^(\S+)-.+\.config$/$1.config/; print '****rename '.$dir . '/' . $file.','. $dir . '/' . $ +prefix . $suffix ."\n"; # rename $dir . '/' . $file, $dir . '/' . $prefix . $suffi +x ; } } }
    dayum i hate double quotes a lot.

      But the above code change we cant get the expected output.you just remove the prototype .I couldnt see any other changes which you have done.

        the manner in which the ***up/***down/****rename lines are printed has also changed so you might understand the lines better.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1184646]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2020-01-26 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?