in reply to Re: renaming files from a tab delimited list
in thread renaming files from a tab delimited list

i have no code to show at this point since I wasn't sure where to start. if you could point me to a module that might work i can start from there.
  • Comment on Re^2: renaming files from a tab delimited list

Replies are listed 'Best First'.
Re^3: renaming files from a tab delimited list
by 1nickt (Canon) on Mar 16, 2016 at 20:17 UTC

    For file operations: Path::Tiny

    use strict; use warnings; use feature 'say'; use Path::Tiny qw/ path /; say qx# ls /tmp/*.txt #; my $dir = '/tmp/'; my $ext = '.txt'; my $regex = qr/$ext/; my @paths = path( $dir )->children( $regex ); for my $file ( @paths ) { my $name = path( $file )->basename( $regex ); my $newname = join '', reverse split '', $name; path( $file )->move( join '', $dir, $newname, $ext ); } say qx# ls /tmp/*.txt #; __END__
    Output:
    /tmp/bar.txt /tmp/foo.txt /tmp/oof.txt /tmp/rab.txt

    Hope this helps!


    The way forward always starts with a minimal test.
Re^3: renaming files from a tab delimited list
by Anonymous Monk on Mar 16, 2016 at 19:52 UTC

    perlintro will give you all the information and example code you need to open and read the file containing your tab delimited list. Inside the loop that reads that file line by line, you could use split to split each line into its components, and then rename to rename the files. Try writing some code, posting it here (following the guidelines in How do I post a question effectively?), and I'm sure someone will be happy to help.