Copy duration attributes in finder

Hi there,


I would like to copy the duration attributes of a list of movie clips from the finder window into an excel doc. At the moment when I copy and paste

the movie clips to excel I copy the file names only, I would also like to copy the duration attributes so I can see a list of movie clip durations.

Can this be done with the finder on another app?


Thanks!

G5, Mac OS X (10.5.2), On XP, Vista, OSX and linux

Posted on Feb 22, 2016 3:30 AM

Reply
6 replies

Feb 23, 2016 9:37 AM in response to Cipiatone

Expanding on the above Automator Workflow, this Automator Service will allow multiple movie files to be selected in Finder, then right-clicking and selecting the Service name will copy the Filename and Duration (in seconds) to the clipboard. Then after pasting into Excel, convert the duration in seconds to: hh:mm:ss, by dividing by 86400 and then ⌘1 and Format as Time-> hh:mm:ss

User uploaded file

TMPFILE=$(mktemp -t temp)

for f in "$@"

do

mdls -name kMDItemFSName -name kMDItemDurationSeconds -raw "$f" >> $TMPFILE

echo >> $TMPFILE

done

cat $TMPFILE | xargs -0 printf "%s \t" | pbcopy

rm $TMPFILE

Feb 23, 2016 11:35 AM in response to Tony T1

A little bit of an improvement.

This will add the divide duration in seconds by 86400 to the clipboard, so that all that will be needed is to Format the cell as HH:MM:ss in Excel:


TMPFILE=$(mktemp -t temp)

for f in "$@"

do

echo -n $( mdls -name kMDItemFSName -raw "$f" )$'\t' >> $TMPFILE

echo "=$( mdls -name kMDItemDurationSeconds -raw "$f" )/86400"$'\t' >> $TMPFILE

done

cat $TMPFILE | pbcopy

rm $TMPFILE

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Copy duration attributes in finder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.