1

I'm not sure if this is something that Automator can do, and would really appreciate any pointers.

I'm working with a folder of ~4500 images. Based on some metadata that I have from another source, I want to move about a thousand of those images to a new folder (it's just too many to move by hand). I have a csv file that includes the names of the files to move, but I can't figure out how to get Automator to let me set the list as a criteria. The filenames are all randomly assigned strings of 32 numbers and letters, so I don't think this is a matter of filtering.

How would I go about moving ~1000 files from one folder to another using a csv/list? Maybe it's possible that Applescript is a good option, but I can't say I've ever looked there at all, so I'd be starting from scratch.

4
  • I wanted something similar a while back to process files - make copies, change bits, so I did a google search and many people have posted code that can be edited.
    – Solar Mike
    Commented Oct 12, 2021 at 19:40
  • 1
    You definition of criteria to move a file confuses me. First you state "Based on some metadata that I have from another source", then you state "I have a csv file that includes the names of the files to move". Also, does the csv file just contain the filenames or is there other that needs to be ignored? Commented Oct 12, 2021 at 20:00
  • Your question as currently written is impossible to give you any realistic guidance as there are too many unknowns! Commented Oct 12, 2021 at 20:48
  • 1
    Please edit your question to provide the following information... 1. What version of macOS are you running? 2. Where are the files to move currently located and where do you want them moved to? 3. Are they all in one folder and being moved to one other folder or what? 4. Provide fully qualified pathname of the locations. 5. Please show a few lines of the CVS file and explain what it is your shown. 6. What is this "metadata that I have from another source" and how does it relate to the question? 7. Is the a one time thing or something that will be repetitive? Commented Oct 12, 2021 at 20:49

1 Answer 1

0

To move files to another folder would not require the use of the Automator or Apple Script. You could accomplish this by entering commands in a Terminal application window.

Example 1

Below is the contents of a file nameed list.csv. This file just contains the names of files to be moved to another folder.

file001,file002,file003
file004,file005
file006

From bash, the command below would move the files to a folder named MyTarget.

(IFS=,; while read -u 5 -a w; do for j in ${w[@]}; do mv -i "$j" MyTarget; done; done)5<list.csv

From zsh, the command would change to the following.

(IFS=,; while read -u 5 -A w; do for j in ${w[@]}; do mv -i "$j" MyTarget; done; done)5<list.csv

Note: You can do a dry-run by preceding the mv with echo. For zsh, the command would appear as shown below.

(IFS=,; while read -u 5 -A w; do for j in ${w[@]}; do echo mv -i "$j" MyTarget; done; done)5<list.csv

This command would produce the following output.

mv -i file001 MyTarget
mv -i file002 MyTarget
mv -i file003 MyTarget
mv -i file004 MyTarget
mv -i file005 MyTarget
mv -i file006 MyTarget

Example 2

Below is the contents of a file nameed list.csv. Here, the name of a file to move is the second item on each line.

black,file001,yes,5
brown,file002,no,6
red,file003,no,7
orange,file004,yes,30
yellow,file005,no,3
green,file006,no,99

From bash, the command below would move the files to a folder named MyTarget.

(IFS=,; while read -u 5 -a w; do mv -i "${w[1]}" MyTarget; done)5<list.csv

From zsh, the command would change to the following.

(IFS=,; while read -u 5 -A w; do mv -i "${w[2]}" MyTarget; done)5<list.csv

You must log in to answer this question.

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