Script error -1728


I’m a newbie to scripting, so please take that into consideration.

I run 3 versions of Windows using Parallels on my iMac. These are held on a volume called “Windows” created on the iMac’s internal SSD. A copy of each file is also backed up to an external drive named TB4. I am hoping to develop a script to determine if a backup is required by comparing the files modified dates for each set of files. The script is in the very early stages, but I’ve hit a brick wall early on.

The source and destination file paths are as follows:

	Windows.  - all 3 files are held on the root directory of the Windows volume (on the SSD)

	TB4/Windows/iMac/Windows 10 VS Code/Current Version
	TB4/Windows/iMac/Windows 10/Current Version
	TB4/Windows/iMac/Windows 10 plus VS/Current Version

I am receiving an error on the last line when running the following script:

tell application “Finder”

(* Windows 10 VS Code*)

set source_folder to "Windows:"
set source_files to entire contents of folder source_folder
set file_name to "Windows 10 VS Code.pvm" as text
set source_file to source_folder & file_name as alias
set dest_folder to "Volumes:TB4:Windows:iMac:Windows 10 VS Code:Current Version" & ":"
set dest_folder to dest_folder as text
set dest_files to entire contents of folder dest_folder

end tell

The error message is:

Applescript Execution Error
Finder got an error: Can’t get folder “Volumes:TB4:Windows:iMac:Windows 10 VS Code:Current Version:”.

The log contains:
get entire contents of folder “Volumes:TB4:Windows:iMac:Windows 10 VS Code:Current Version:”
No such object(eg specifier asked for the 3rd, but there are only 2) (errAENoSuchObject - 1728)

I suspect it might be caused by embedded spaces in folder names, but using ‘quoted form of’ has not solved the problem.

Apologies for the verbosity but providing all relevant information may avoid the need for a lengthy conversation

Can anyone suggest a fix for this problem?


I doubt invisible character is in any directory name.
Some eccentric language require some character input program sometimes make invisible character input due to the bug of them.

Try it without “volumes:” in the path.

set dest_folder to "TB4:Windows:iMac:Windows 10 VS Code:Current Version" & ":"

Hi Ed,

That has worked, thanks.
Strange, as a script I developed years ago to rename Lightroom files that also reside on TB4, and that script includes “Volumes” - and works.

Many thanks for your prompt response, Ed.
Stay safe


1 Like