Find Files Listed in a Text File and Copy Them to a New Folder?

Hi everyone! I'm on Mac 10.15.17 and KM 9.2.

Can KM search for files listed in a text file (could be any kind) and copy to another folder?

I'm a photographer and have some schools that fill out a google form to select their yearbook portrait of choice. Here is a sample CSV file but it could be just a list of filenames if it's easier.

KM Sample Find (949 Bytes)

Thank you in advance!

The source files are in the same folder as the CSV file ?

They just get copied (without name change) to a target folder ?

The first and last name columns don't feed into the outcome in any way ?

Hello and thank you!

Source files are in multiple different folders, organized by date, but I could easily move everything to the same folder if needed.

Yes, just copied, to target folder.

For this purpose, the first and last name are extraneous data but the next step, after all files have been copied into TargetFolder would be to import TargetFolder into photography lab software along with original csv file for data matching.

A problem in your example might be that you have only file names rather than file paths there in the CSV – i.e. a macro/script might have to search across several folders, and might find more than one match for a file name (same name, different folders)

import TargetFolder into photography lab software along with original csv file for data matching.

Again, for a unique link between a given file name and an actual file, you would probably need either:

  • All source files in one folder, or
  • Full file paths in the csv file

A rough kind of pattern might look like:

Thank you again! It would be easy for me to move all files into one source folder so only that folder has to be referenced.

I've posted a rough template above, which seems to capture filenames from that CSV

(ignore the accidental TaskPaper context at the the top, of course)

In the copy from field, you should be able to supply a folder path, followed by %Variable%maybeFileName%

Awesome, thank you very much! :grinning: I will try it!

Hello again!

One question. For “The substrings” I don’t seem to have option “separated by matches in”.

Forgive me – try this, perhaps:


matching in

Of course, no need to even ask for forgiveness! :slight_smile: That did the trick, thank you very much! One small thing, the display text window that pops up, in some cases I'll have 1000+ files which means 1000+ popup windows. Is there a way to turn off or modify so it closes after?

You can switch those windows off (included there only for testing) by disabling or deleting the Display Text action.

(The gear wheel at top right of an action opens a menu. Disable action is the second menu item)

perfect, thank you very VERY much, this will save me a lot of time.

1 Like