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.

 

About

These posts showcase some excellent examples of why Keyboard Maestro is a must-have for every Mac OS user. As a powerful automation tool, Keyboard Maestro helps boost productivity, save time, and streamline repetitive tasks. With its vast array of customizable features and functions, it's the perfect choice for Mac OS users seeking to optimize their workflow.

Schedule

SundayOpen Topic
MondayMedia Monday
TuesdayQA
WednesdayAffinity
ThursdayBBEdit
FridayMacintosh
SaturdayInternet Tools