Automator Action/Bash Script for selecting files from a list 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?
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/ \; &lt; 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.