Keyboard Maestro Copy File
Quick way to copy files from a USB device
Last Summer I purchased a Sony IC Recorder (ICD-UX570). Its a powerful audio recorder that saves files on the internal drive or the microSD expansion.
In order to download the audio from the recorder, I need to connect the device to the computer and drag the files from the device to my hard drive.
I decided to create a Keyboard Maestro Macro that would do that process automatically.
The task of this macro:
When the device is inserted into the computer, copy the files from the Internal 4GB memory to the ~/Music/Sony/ folder. Each audio should be in a folder with the date the recording was made.
Keyboard Maestro Macro
This is the Macro that I came up with:
Now when I insert the Sony Recorder, the files automatically get copied. I don't have to think about it. I can still move the files if I want, but I am guaranteed that a backup copy was made to the computer.
#!/bin/bash cd /Volumes/IC RECORDER/REC_FILE/FOLDER01 for f in *; do dir="/Users/cryan/Music/Sony/"$(stat -f%SB -t%Y-%m-%d "$f") # echo $f '->' $dir [ -d "$dir" ] || mkdir "$dir" cp "$f" "$dir"/ done
This was a quick fix, using BASH. There is a better way to do this in Keyboard Maestro using a lot of the built-in actions. Next week I'll show you the "official" way to do this using Keyboard Maestro
The "pause" is needed because Keyboard Maestro works immediately when the device is connected - the file system doesn't even see it yet.
Add your Comments
Feel free to leave a comment about this post.
© 2022 - cryan.com