Move files from one folder to another using list

I am trying to use AppleScript to pull files from a folder that I have in a list. I have a folder with thousands of files in it. All of the files are named with the following setup:

A123456_John_Doe.tif

The A123456 number is different on each file. I also have an excel list of just the A123456 numbers that I need to pull from my large group of files. I want to move/copy/highlight just the files that match the A123456 numbers that are in my list.

I know little about AppleScript. Please help!

I don’t believe MacScripter, or Stack Overflow is a place to source work for free. Show some effort and post how you would go about solving your problem. Even if you are not close, it will show that you have tried.

http://stackoverflow.com/questions/10235867/copying-files-from-one-folder-to-another-using-applescript-and-a-list-of-file-na

While you are asking for alot of advice, it might comfort you to know that you can get all the information out of Excel and use it to move the files. It doable. Here’s a few subroutines you might investigate to help get you started.

This code can make the right excel document and worksheet frontmost:

to makeExcelWkBkAndShFrontmost(shName, wbName, delayTime)
	-- P0426v1.00
	-- Independent
	
	set successFlag to false
	try
		tell application "Microsoft Excel"
			activate
			delay delayTime
			activate object workbook wbName
			delay delayTime
			activate object sheet shName
		end tell -- application "Microsoft Excel"
		set successFlag to true
	end try
	
	set output to successFlag
end makeExcelWkBkAndShFrontmost

This subroutine can get data from a cell on the Excel worksheet:

to getDataFromExcelCellByRC(rowNum, colNum, shName, wbName, dataType)
	-- P0158v1.10
	-- Independent
	
	-- if dataType = 1, then the DATA value is obtained, else the STRING value is obtained
	
	tell application "Microsoft Excel"
		if dataType = 1 then
			set output to value of cell rowNum of column colNum of sheet shName of workbook wbName
		else
			set output to string value of cell rowNum of column colNum of sheet shName of workbook wbName
		end if -- dataType = 1
	end tell -- "Microsoft Excel"
end getDataFromExcelCellByRC

And this can move a file (or folder if I remember correctly) to another location:


to moveFinderItem(pathToFinderItemToMove, pathToNewLocation)
	-- P0185v1.00
	-- Independent
	
	tell application "Finder"
		move (pathToFinderItemToMove as alias) to (pathToNewLocation as alias)
	end tell -- application "Finder"
end moveFinderItem