As a part of my workflow, I often face this scenario:

  • I have a folder with let's say, 100 files named 1.mov to 100.mov
  • I have a list of valid files let's say, files 1.mov, 2.mov .... 15.mov (These names can be random)

Now I want finder to separate the valid files from the heap of original files by either marking them or creating a new folder and copying them recursively.

How can I achieve this with automator?

1 Answer 1


Given a text file, filelist.txt, containing the files enumerated, one per line, the following command will move those files (and only those files) found in the current directory and beneath it, to a directory, destination, located in the user's Documents folder:

xargs -J % find . -name % -exec mv {} ~/Documents/destination/ \; < filelist.txt

xargs: accepts the files listed coming from stdin (or in this case, filelist.txt), replacing their path into the % variable in the following find command

find: locates those files if they exist, then executes the following command on each file

mv: moves the found file, represented by {}, to the destination

Incorporating this line into an Automator workflow is left to the reader.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .