Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # https://stackoverflow.com/questions/2601027/how-can-i-check-if-a-file-exists-in-perl
- # https://stackoverflow.com/questions/3455956/how-do-i-get-the-dirname-of-a-file-with-perl
- # https://stackoverflow.com/questions/67965882/finding-a-file-in-directory-using-perl-script
- use File::Find;
- use File::Basename;
- my $curr_path="var";
- my @content;
- find( \&wanted, $curr_path);
- for my $b (@content) {
- if (-f $b) {
- $tmp_name = dirname($b)."/1";
- rename $b, $tmp_name or die "$b: 1st rename error";
- rename $tmp_name, $b or die "$b: 2nd rename error";
- }
- }
- exit;
- sub wanted {
- push @content, $File::Find::name;
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement