0

I want a shell script that runs on a Mac, that when ran, looks for a few things and transfers video files to a specific location on another drive.

So when I put in an SD card, I want the script to autorun, look for files under 300 MB, leave those on the disk, rename the files over 300 MB from "file0001.MOV" to the current date with a number after them.

SO if I have a disk at the time of this post with this shell script on it, insert the disk into the computer with files:

file001.MOV (30 MB)

file002.MOV (500 MB)

file003.MOV (480 MB)

It automatically renames file002.MOV to 20140413-1.MOV and file003.MOV to 20140413-2.MOV and transfers them to D: (or whatever drive I want).

  • What have you already tried? Where did you get stuck? Please note that we expect a little bit of effort shown—people probably won't write a full script for you. – slhck Apr 14 '14 at 6:00
  • Well that's just it... I don't know where to start. With the autorun feature I'm talking about, I was wondering if I should use Python, Java, a shell script, Automator, etc... So if I have someone who can guide me in the right direction I am definitely willing to start putting in the work. I am just starting right now, so I have done no work on this. – Fridgecritter Apr 14 '14 at 13:51
  • I'll be totally honest with everyone, I have no idea what I'm doing. But that didn't stop me from writing a PHP page and converting it to an app. – Fridgecritter Apr 14 '14 at 14:17
0

You should look up shell parameter expansion, it's the tool I'd use for file renaming. There's a built in date function so renaming should be easy enough.

The Autorun part can be handled by launchd, which has can start an application when you mount a volume. You'd have to write your script to check that it's the right volume before moving the files which might be a bit more tricky.

  • I will start there... awesome, thanks for the input. – Fridgecritter Apr 15 '14 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.