|
|
#1 |
|
Prospect
Join Date: May 2010
Posts: 21
|
Modify Files According to List
Hello,
I've got a massive treasury of old family film footage that I'm importing into iMovie '11. When I import the files, it classifies the movies as the current year rather than the date when they were actually created. I've discovered I can change the date displayed in iMovie by using the "touch" command in terminal to alter iMovies files in "~/Movies/iMovie Events". Furthermore, I've discovered this lovely script which makes it quite easy to modify individual files. However, I've got 300+ files and don't want do that to each one. I noticed that iMovie preserves name for these files. Therefore, I have two directories with the same file names: 1) My original files with the correct "date created" as ".mpg" files located in "~/Movies/SonyCam/Vacations" 2) iMovie's imported footage with today's date as ".m4v" files located in "~/Movies/iMovie Events/Vacations" My goal is have an Applescript that will take the "date created" from each ".mpg" and apply it to the respective ".m4v". Is this possible? If so, where do I start? Thanks, Mitch |
|
|
|
|
|
#2 |
|
MVP
Join Date: Dec 2009
Location: Pembroke, Ontario
Posts: 2,051
|
Likely you can:
A) get the file name and both associated files B) get the one correct date C) set the other's modification date (can't create new creation dates) Pretty easy in vanilla AS. Being away from a Mac, I can't help right now. |
|
|
|
|
|
#3 |
|
Hall of Famer
Join Date: Dec 2007
Posts: 3,649
|
A Better Finder Attributes should do the trick, and if all of your footage has already been imported, I think you'll be able to make all of the desired modifications during the software trial period.
|
|
|
|
|
|
#4 |
|
Prospect
Join Date: May 2010
Posts: 21
|
@renaultssoftware I'm glad to hear that this is possible. Sadly, such scripting is beyond my capabilities
![]() @NaOH While that software is a very polished solution, I don't see what additional functionality it delivers over my droplet. My videos span twenty years and I hope to avoid modifying each one individually. And while the "instant droplet" is nice, I'd still have to make a new droplet every four or five clips. |
|
|
|
|
|
#5 |
|
MVP
Join Date: May 2004
Posts: 2,013
|
I can put something together for you, I've done things very similar in the past.
First though, do you need the creation date to be set? Or just the modification date? Same question for where to get the date (creation or modification). These will have an impact on what tools I use in the shell script. |
|
|
|
|
|
#6 |
|
Prospect
Join Date: May 2010
Posts: 21
|
@fracai Thank you very much! I believe I want to grab and set the creation date. Previously, I used this script which set the correct metric to fool iMovie – so whatever that script did is sufficient.
Last edited by mdwittenberg; 12-27-2010 at 12:01 PM. |
|
|
|
|
|
#7 |
|
MVP
Join Date: May 2004
Posts: 2,013
|
OK, that script is actually setting the access and modification dates. I'll give you a script which does the same and if it doesn't work I can update it to set the creation date. I'd like to avoid setting the creation date because that requires that you have the developer tools (GetFileInfo and SetFile).
Give me just a few minutes to test it out. |
|
|
|
|
|
#8 |
|
MVP
Join Date: May 2004
Posts: 2,013
|
Give this a shot:
Code:
#!/bin/sh
SOURCE_PATH=~/"Movies/SonyCam/Vacations"
UPDATE_PATH=~/"Movies/iMovie Events/Vacations"
SOURCE_EXT="mpg"
UPDATE_EXT="m4v"
for FILE in "$SOURCE_PATH"/*."$SOURCE_EXT" ; do
BASE=$(basename "$FILE" ."$SOURCE_EXT")
if [[ -f "$UPDATE_PATH"/"$BASE"."$UPDATE_EXT" ]];
then
echo "$FILE"
DATE=$(stat -t %Y%m%d%H%M.%S -f %Sm "$FILE")
touch -t "$DATE" "$UPDATE_PATH"/"$BASE"."$UPDATE_EXT"
fi
done
Let me know if you have any problems or need the creation date set (I'm guessing that if the other script worked you'll be fine). It basically operates on each file in the source directory and if a corresponding file is found in the iMovie directory it copies over the access and modification dates. |
|
|
|
|
|
#9 |
|
Prospect
Join Date: May 2010
Posts: 21
|
Sadly, that script did not work for me. I made it excitable in terminal, but it returned the shell very quickly when I ran it and didn't change the files.
I must admit that I fibbed in my first post for simplicity's sake (thinking that I could change the paths myself afterwards). The original files are actually located in an external drive "M and M" and the converted files aren't quite in iMovie yet. Furthermore I changed my mind and am converting to "mov" instead of "m4v". Here's what I modified: Code:
... SOURCE_PATH="/Volumes/M and M/Conversion Puragtory/Sony/07.04.15 Florida Vacation" UPDATE_PATH="/Users/Projects/Movies/Ready for iMovie/Florida Vacation" SOURCE_EXT="mpg" UPDATE_EXT="mov" ... |
|
|
|
|
|
#10 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,957
|
Add in a line:
echo "processing $FILE" right after the 'for' statement. Then you can see what files are being processed.
__________________
hayne.net/macosx.html |
|
|
|
|
|
#11 |
|
Prospect
Join Date: May 2010
Posts: 21
|
@hayne: Followed you suggestion and was returned
Code:
processing /Volumes/M and M/Conversion Puragtory/Sony/07.04.15 Florida Vacation/*.mpg |
|
|
|
|
|
#12 |
|
MVP
Join Date: May 2004
Posts: 2,013
|
That indicates that it's not actually finding any files to process. Are you sure you have the paths correct? Try the following command, do you see all your movies listed? Your UPDATE_PATH also looks iffy. Do you really have a user called "Projects"?
Code:
ls -la "/Volumes/M and M/Conversion Puragtory/Sony/07.04.15 Florida Vacation"/*.mpg |
|
|
|
|
|
#13 |
|
Prospect
Join Date: May 2010
Posts: 21
|
@fracai Ah! Thanks for the troubleshooting "ls -la" command. I figured out that my files' extensions are capitalized ("MPG") and the script was looking for lower case "mpg". Once I fixed that in the script it worked perfectly.
|
|
|
|
|
|
#14 |
|
MVP
Join Date: May 2004
Posts: 2,013
|
:-)
I'm glad it worked and am happy to have helped. |
|
|
|
|
|
#15 |
|
Prospect
Join Date: May 2010
Posts: 21
|
You're the bomb fracai
![]() Now I may be asking for too much, but is it possible to squeeze this into applescript/automator? My dream would be to have this in a foolproof AS or Automator action where the user picks the source folder, destination folder, and then the computer figures out the extension and does the time modification. These are my parents' videos and I'd prefer if they could manage future imports themselves. ps I've found you can have multiple shell variables in automator. Last edited by mdwittenberg; 12-28-2010 at 11:55 PM. |
|
|
|
|
|
#16 |
|
MVP
Join Date: May 2004
Posts: 2,013
|
I'm not much of an AppleScripter or Automator...er, but it'd certainly be possible to convert this. I think AS even has the capability for getting and setting modification times without going out to the shell.
The Hint you linked to, and the comments, probably have all you'd need to select source and update folders and then use the general pattern of my script to perform the update. But, again, it's not my expertise. |
|
|
|
![]() |
| Tags |
| imovie 11 |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|