1

I had a bunch of video files (.TODs - mpgv video, mpga audio) that were useless unless I converted them, so I did.

Once I converted them, the "Date Created" and "Date Modified" (that you see in the Finder) were obviously changed, since new files were created from the old ones. Is there an easy way to move the data for the dates from the old files to the new ones (preferably not manually)? The project I am doing is chronology-dependent, so being able to sort by date is essential.

I would be willing to convert all the files again, if there was a way to retain the info through conversion in either a different converter.

I used ffmpegx with a program called "Quick Batcher" so I could batch convert the files. I'm on a Mac, with Mac OS X 10.6.2 (Snow Leopard). Any help would be really appreciated!

flag
what kind of file format is that ? how did you convert ? – lImbus Jan 27 at 9:38
.TOD is a proprietary JVC video format that uses the mpga audio codec and mpgv video codec. I used ffmpegX to convert them into .MOV files. – Grant Jan 28 at 2:51
Are you using mac of PC? – Lan Bui Jan 28 at 21:33
Mac on OS X 10.6.2 (Snow Leopard) – Grant Jan 28 at 23:55

1 Answer

1

the unix command touch is avaiable on your mac. this tool allowes you to change the date created and date modified-fields of your files in the filesystem (is suppose this is what finder evaluates).

If you have a lot of files, and you still can correlate them (If nameA.tod has become nameA.mov), you can easily script this command with a little bit of bash magic, applying the .toc-dates to the .mov-files.

Otherwise, you can still do that manually:

touch -r nameA.tod nameA.mov

This will transport access and modification time from the tod-file to the mov-file. Also, you can specify the timestamp yourself:

touch -t 200905172359 thefile

will change the access and modification date to the 17th of may last year, the minute before midnight.

Type "man touch" to see all options.

BEWARE: If you run touch on a file without parameters, it will update it to the current time. This might break your history and logic. If you mistype the filename, touch will create the file (with size 0)

EDIT: There we go, updating to explain how to script this. In unix and bash, there is usually two ways to base a loop on files. One way is the find . -exec echo {} \; which gets just a bit too complicated in this case. The other way is to write a shell script file and program a proper loop:

#! /bin/sh

for oldname in *.tod; do
    namebase=`echo "$oldname" | cut -d'.' -f1`
    touch -r $oldname $namebase.mov
done

Let's explain this quickly:

  • the first line is the so called "she bang line" which tells the system how to run this script. It is precisely a comment indicating the path to the executable needed.
  • the for loop (everything indented is "in" the loop) helps us doing a task repeatedly.
  • every dollar sign indicates the use of a variable, where definitions of a variable do not need a special character.
  • the way we ask for the for-loop, the content will be run for every file matching the pattern, so every file ending on .tod. The filename of the current instance can be found in the variable "oldname", since this is the name of the former file, before the conversion.
  • the first line "in" the loop stores the the base of the filename without extension, so we can add another in the second line.
  • the second line is the touch command as explained before, just applying the variables
  • the last line just finishes (or "closes") the loop.

Now, let's see the steps we need to get this running:

  • The contents as above need to be copied in a file, preferably in the directory where the files reside. If needed otherwise, the script need to be adapted.
  • Preferably, this file is called something.sh, like retoucher.sh or transferTimestamps.sh
  • This file needs to be made executable. For this, we need a shell/terminal/commandline in the directory where the file resides, but I take this for granted, since you got already this far (and for other reasons). To render the file executable type and execute chmod +x retoucher.sh (it adds the eXecutable flag to the file 'modes')
  • then already the file can be executed: It needs just a little prefix to it's name, so that the system knows where to find it, the local directory is never assumed: executing ./retoucher.sh will do the trick (without any messages of success).

Pfew, I hope that helps :) If not, feel free to tell my why in the comments, I'll try to repair and refine this description.

link|flag
Thank you for the response! I tried doing one of the files manually, and it worked great! The file names have stayed the same (namea.tod -> namea.mov), but I'm not sure what you mean exactly with the bash commands and scripting (I'm not an experienced scripter/Unix guy). What kind of script could i write so that x.TOD in folder A corresponds with x.MOV in folder B, and have it automatically take care of all the files? – Grant Feb 21 at 3:37
sounds good. thank you! – Grant Feb 21 at 20:30
when i tried executing retoucher.sh, I get: touch: *.tod: No such file or directory – Grant Feb 22 at 22:31
mhmm. your files are well called .tod, right ? or are they called .TOD ? Then of course, this has to be adapted in the script, since unix file systems are case sensitive. – lImbus Feb 24 at 0:41
thats what it was. worked great! thanks. – Grant Feb 24 at 20:45
show 1 more comment

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.