System evnts doesnt recognize a folder on external drive?

Hi All

I have this script which has worked flawlessly for years, and now doesn’t
seem to recognize the folder “MOVE” which is on a external drive.

the error I am getting is

System events got an error: can’t get folder “/Volumes/MOVE/”

andy ideas why this may be?, OSX 10.10.3

set PathToTransferFolder to "RIP FILES:MOVE:" as text 
set this_folder to (PathToTransferFolder) as alias

tell application "System Events"
	set these_items to POSIX path of files of folder "/Volumes/MOVE/" whose name ends with ".indd.ps"
end tell

Hi,

the syntax is correct and should work. However this is simpler


set this_folder to alias "RIP FILES:MOVE:"

tell application "System Events"
	set these_items to POSIX path of files of disk "MOVE" whose name ends with ".indd.ps"
end tell

Hey Budgie,

Both of these work fine for me:


set _dir to "/Volumes/G-DRIVE/DropBox_Backup/"

tell application "System Events"
	set fileList to POSIX path of files of folder _dir whose name ends with ".zip" or name ends with ".indd.ps"
end tell

set dirAlias to alias "G-DRIVE:DropBox_Backup:"

tell application "Finder"
	set aliasList to (files of dirAlias whose name ends with ".zip" or name ends with ".indd.ps") as alias list
end tell

I prefer to use the Finder for this sort of thing ” but as alias list is the key to that ” because Finder references suck and are slow.

I prefer an alias list, because it can be copied or moved en mass.

I prefer to always use aliases and HFS paths unless I have a specific need for a posix path or posix file. (They simply are more portable.)

That said I do advise that you NEVER mix and match HFS paths and Posix paths, unless there is a very specific need.

Use one or the other but not both. It prevents a lot of problems.

thanks guys for both replies and info, appreciated

I must be having a glitch here as I cannot for the life of me get either of the POSIX path scripts
suggested to work, as for the finder code, excellent, couple of alterations to suit
my work flow and all is good. strange
just in case, this code is running on OS X 10.10.3 late 2014 mac mini, 2TB external seagate

cheers

Weird.

Go to the source. Run this on the folder in question:


tell application "Finder"
	set f to selection as alias
end tell

set hfsPath to f as text
set posixPath to POSIX path of f

return & hfsPath & return & return & posixPath & return

That will get you the verbatim paths in hfs and posix form.

Then run this on the hfs path and see if it resolves:


set a to alias <the hfs path>

Hi,

Why not just bite the bullet and write the script as it is supposed to be. This line:

 set these_items to POSIX path of files of folder "/Volumes/MOVE/" whose name ends with ".indd.ps"

is using a AppleScript reference with a unix reference. It doesn’t look right. Either change the string or drop the ‘folder’.

gl,
kel

it doesn’t look right but it is right.
Unlike the Finder System Events can deal with POSIX paths

Hi Stefan,

Yes, I’ve noticed this about System Events lately. It’s smarter. But Still it’s good to write things as it should be. Who knows, they might change things in the future.

hgd,
kel

I ran your code Chris and it returned error for the POSIX, and fine for the HFS.

I deleted the folder in question and added a new one, renamed it, and now
both options (posix & hfs) work again, go figure.

something must have been corrupt, I had a drive die on me so had to restore
26.0000 .ps files from a sparse image backup, that folder was part of that
sparse image, can’t think of anything else.

thanks for the input