Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Changing filenames

by pikov22 (Initiate)
on Apr 26, 2011 at 00:31 UTC ( #901260=perlquestion: print w/ replies, xml ) Need Help??
pikov22 has asked for the wisdom of the Perl Monks concerning the following question:

I'm a novice perl user who has Active Perl installed on my Windows 7 computer.

I have a directory full of files with names like text134.txt and the first line of each contains what I would like to change the filename to. For example, text167.txt consists of these seven lines:
Canon Camera

Doc copy-
1 set camera to M
2 press FUNC SET
3 select Digital Macro (tulip w/D)
4 press FUNC SET

I would like to change the file's name to canon camera.txt or canon_camera.txt (the case of the initial letter is immaterial to me)

Would some kind soul write a simple script for me? Thanks.

Comment on Changing filenames
Re: Changing filenames
by Anonymous Monk on Apr 26, 2011 at 00:43 UTC
      Thank you.

      I'm almost 80 years old and I have no desire to start learning perl.

      And by the time I learned enough to write a script that worked, I probably could have done the renaming manually.

        If you are willing to write a program that can read one file and figure out what to change its name to, I will write the rest of the program for you.

        (If you aren't already reading a good book or tutorial, my Modern Perl is available as a free download.)

        Perhaps, but once you learned enough to write a script, you'd have the knowledge to address the problem quickly, with the same script, the next time it arises...
Re: Changing filenames
by ww (Bishop) on Apr 26, 2011 at 02:16 UTC
    Both previous answers allude to this (and offer some points supporting it): I'll make it explicit.

    PM is a place for learning; not a place to come for free scripts. We'ld love to help you learn, if you wish to do so and put some effort into it.

    To that end, you might want to start by reading The Perl Monks Guide to the Monastery and at least some of the offerings in PerlMonks FAQ.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2014-08-30 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls