Jez
Jez

Reputation: 65

Split file with Automator and 'split' command

I'm currently using the split command to split a large file into many 50MB files. For example:

split -b50m filename.ext filename.ext.

This works really well, but I'd like to use Automator to create an application that I can give to a friend who is less familiar with the command line.

I realise that there are existing applications which can handle this (e.g. Split&Concat), but I want to use this as an opportunity to learn about Automator. This is what I would like to achieve:

  1. Drop file on application icon (e.g. filename.ext)
  2. Split files and name them filename.ext.aa, filename.ext.ab, ...
  3. Create new files in same location as original file

How do I pass the file name to the command line?

Upvotes: 2

Views: 2533

Answers (1)

Kassym Dorsel
Kassym Dorsel

Reputation: 4843

When you save the Automator script as an Application the dropped file is passed to the first action automatically.

Select the Run Shell Script pass the input in as an arguments and access it using $@.

You can use the above split command instead. The following Automator takes the input file and moves it to the ~/Desktop/haha folder. enter image description here

Upvotes: 3

Related Questions