This is a pesky problem in OS X 10.4. When using the “list folder” command with a folder (or path containing a folder) of 32 or more characters will result in a “Bad name for file” error. Even though the OS can handle longer names, this command can not. This problem exists for local folders as well as folder on an OS X server.
This problem appears to have been fixed as of OS 10.5.2 (even though my server is still using 10.4). It may or may not exist in 10.5.1.
[Updated] My original post erroneously showed an error return value for each attempt.
-- Note: If you try this code you will need to modify the volume name to your own server volume and create the folders.
-- Server Test
--------------------
list folder "Volume Name:abcdefghijklmnopqrstuvwxyzabcde:" -- 31 characters works
-- returns a list of items
list folder "Volume Name:abcdefghijklmnopqrstuvwxyzabcdef:" -- 32 characters fails (ERROR)
-- returns error "bad name for file"
list folder "Volume Name:abcdefghijklmnopqrstuvwxyzabcdef:" -- using an alias rather than a string works
-- returns a list of items
-- Local Test
--------------------
list folder "Macintosh HD:Users:mmunro:Desktop:abcdefghijklmnopqrstuvwxyzabcde:" -- 31 characters works
-- returns a list of items
list folder "Macintosh HD:Users:mmunro:Desktop:abcdefghijklmnopqrstuvwxyzabcdef:" -- 32 characters fails (ERROR)
-- returns error "bad name for file"
list folder "Macintosh HD:Users:mmunro:Desktop:abcdefghijklmnopqrstuvwxyzabcdef:" -- using an alias rather than a string works
-- returns a list of items