Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: renaming files from a tab delimited list

by flieckster (Scribe)
on Mar 16, 2016 at 19:46 UTC ( [id://1157991]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2024-04-25 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found