Get JPG filenames from csv file, find files then delete

Hi folks,

I need a bit of help with this one, its got me stumpted.

PROBLEM OUTLINE: I need an applescript / or possibly an automator script or combination of both to perform housekeeping functions, essentially getting a list of JPG names from a csv / txt file and finding them from a folder called ‘images’ on a windows volume and then deleting them.

The csv / text file will be created by filemaker and I have control over the structure of the file if this helps.

My aim, once this script works will be to attach it to a folder as a folder action essentially creating a “hot-folder” and I will have filemaker write the csv / text file into the folder.

Thanks in advance for any help offered by the community!

Hi peninsular,

I created a windows csv file in Microsoft Excel with one column containing names of files. Here, I used a disk image instead of a windows volume as my disk.


set f to choose file with prompt "Choose the csv file:"
set t to read f
set file_names to paragraphs of t
tell application "Finder"
	delete (every file of folder "images" of disk "MyDisk" whose name is in file_names)
end tell

You can add Finder’s ‘empty’ command to empty the trash. A small mod canchange this into a folder action.

gl,