1. Reminder: Please use our affiliate links for holiday shopping!

Need help: Unix script for renaming files

Discussion in 'Image Processing' started by sprinke, May 10, 2011.

  1. sprinke

    sprinke Mu-43 All-Pro

    Apr 5, 2011
    Pasadena, CA
    Debi
    I'll bet there is someone on this forum who can help me out with this.

    I want a simple Unix shell script that will take the MTS files (AVCHD) generated by my GH2 and rename them in the following format:

    YYYYMMDD_originalfilename.MTS

    where YYYYMMDD is the creation date of the file. Or the modification date, which should be the same thing if it's coming directly off the camera.

    I should add that I actually use a Mac. I've tried setting something up with Automator scripts but it fails with an odd error claiming that it can't convert the modification date into a reference.

    Given enough time, I probably would (like the monkeys with typewriters) be able to kluge something workable, but I thought maybe there are some Unix/Linux gurus lurking around here.

    Thanks!
     
  2. travisennis

    travisennis Mu-43 Regular

    63
    Dec 27, 2010
    Indiana
    I am away from my computer right now but I have a python script that should do the trick. I can send it to you when I get back to my machine.
     
  3. mauve

    mauve Mu-43 Top Veteran

    892
    Mar 9, 2010
    Paris, France
  4. sprinke

    sprinke Mu-43 All-Pro

    Apr 5, 2011
    Pasadena, CA
    Debi