QA Graphic

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

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:

Sony Audio File

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.

Bash Code

#!/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

Some Notes

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.

 

Comments

Add Comments

Name:
Comment:

 

About

These posts highlights some cool examples of why Keyboard Maestro should be part of every Mac OS user's computer. Keyboard Maestro is a powerful automation tool that can help improve productivity, save time, and streamline tedious tasks. It has a wide range of features and functions that can be customized to suit any user's needs, making it an ideal choice for Mac OS users.

Schedule

Monday Media Monday
TuesdayQA
WednesdaySnagIt for QA
ThursdayPython
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic