December 15, 2021

Backup USB items

Use Keyboard Maestro to auto backup USB drive

This week's is a followup to the "Keyboard Maestro Copy File" blog post. In this week's post, I'll show you how to use Keyboard Maestro's actions to perform the same BASH function.

This is a great example of understanding the power that Keyboard Maestro has. While the BASH code is shorter in code, I feel the Keyboard Maestro version is more flexible in doing other actions.

Simple Task

Create a Macro that will copy all the documents in a particular folder and place a copy of them in a new location based on their created date.

Actions used

  • Get File Name to Variable
  • Get File Type to Variable
  • If All Conditions Met Execute Actions
  • Get Date Created to Variable
  • Set Variable to Text
  • Create New Folder
  • Copy File

Keyboard Maestro Macro

Sony Action Steps

These are the steps in the screenshot:

  • Pause for 1.5 Seconds - Wait for the USB drive to fully mount.
  • For Each Item in a Collection - For all the files in a particular directory on the Sony Recorder execute the following actions.
  • Get File Name to Variable - Save the file name to a variable to be used later.
  • Get File Type to Variable = Identify the type of file in this loop cycle.
  • If All Conditions Met Execute Actions - Now lets take actions only on files and not folders
  • Get Date Created to Variable - Get the file created date and assign it to a variable
  • Set variable to Text - Assign the date format to a human readable format. (Example YYYY-MM-dd)
  • If All Conditions Meet Actions - Check to see if the directory exists.
  • Create New Folder - Create a new folder if it doesn't exists.
  • If All Conditions Meet Actions - Check to see if the file already got moved over.
  • Copy File = Move the selected file to the directory

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!

 

© 2022 - cryan.com