An ever-changing file location

Hello,

I’m new to the forum, and I think I have an interesting puzzle for anyone who wants to address it.

I have a folder we’ll call folder A. Inside are two folders, which are always called “Layout” and “Dummies”.

I want to copy a file from Layout to Dummies. Simple, right? The problem is that I’m using a different folder as “A” every night. The names of the subfolders stay the same, but the “A” folder changes. So I can’t directly define a specific path. If necessary, I can have people “choose” a location for both the original and the copy, but I would prefer to have them just choose the original and have the script automatically place the copy.

Thanks for any help you can give with this!

Try something like this:

tell application "Finder"
	activate
	choose folder
	
	try
		duplicate file ((result as text) & "Layout:YourFileName.txt") to folder ((result as text) & "Dummies:")
	on error errorMsg number errorNum
		display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
	end try
end tell