Renaming files by matching info from a separate file

Discussion in 'Mac Programming' started by Demosthenes, Apr 28, 2010.

  1. Demosthenes macrumors newbie

    Joined:
    Mar 30, 2009
    #1
    Hi All,

    I could use a bit of help with this as I'm at a loss. Hope this is the right place.

    I have a number of files all named accordingly:

    I have a separate text file that is as follows:

    What I want to do is end up with:

    I don't know how to do this, though I'm certain it can be done, and would rather learn how than do it all manually. If someone could just point me in the right direction or post the basics so that I could have a starting point I'd much appreciate it.

    So far all I've managed to do is replace the ^M from the text file with \r so that cat works properly on it.

    Thanks.
     
  2. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    This isn't too uncommon. You could probably find a Perl script you could edit that would do the job.

    The script would read the file.
    Pase each line for that middle value.
    Use the value to search for files in a folder that begin with that name.
    Rename each file.
    Loop back to parse the next line.

    Type the following into Google;

     

Share This Page