• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Elementary fie naming question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Elementary fie naming question


  • Subject: Re: Elementary fie naming question
  • From: Graff <email@hidden>
  • Date: Sat, 10 Jan 2004 13:22:15 -0500

It is generally a bad idea to use certain characters in names. Those characters are mainly forward slashes (/) and colons (:). The forward slash is a path delimiter for the shell environment and the colon is a path delimiter for the Finder.

It used to be that if you specified a date as part of a name in the Finder and it had a format of xx/xx/xx it would automatically change to xx-xx-xx. It now looks like the Finder leaves that untouched, which is potentially a bad thing. If a shell tool is used on a name that has forward slashes in it then that name could get misinterpreted. For example a file with the name aaa/bbb in the Desktop folder would be referenced like this in the shell:
/Users/username/Desktop/aaa/bbb

To the shell that looks like file bbb in directory aaa in directory Desktop, and so on.

The same thing happens for files with a colon in them in the Finder, although it is rarer to have a problem there due to the fact that the Finder doesn't depend on paths as much. Here's how the file aaa:bbb looks in the Finder:
Macintosh HD:Users:username:Desktop:aaa:bbb

Again, a similar problem to the shell, the Finder can sometimes interpret this as file bbb in folder aaa in folder Desktop, and so on.

Another example of confusion, I named a folder "Date 10/20/02" on the Desktop in the Finder. When I did a listing of the Desktop through the shell environment that same folder was named "Date 10:20:02". This sort of conversion is useful under certain circumstances but it also has potential to cause big problems.

Best bet is to entirely avoid using forward slashes and colons in your file and folder names. This will steer clear of any confusion and bugs that might pop up due to the handling of those file names.

- Ken

On Jan 10, 2004, at 12:31 PM, Axel Luttgens wrote:

Graff wrote:

The problem is the underlying Unix-like nature of Mac OS X. You can't have a file name that has a slash (/) in it because that character is used for separating directories. In the Finder all slashes (/) are automatically translated to dashes (-).


I'm not sure to fully understand what you mean.
This one:

tell application "Finder"
make new file at desktop with properties {name:"aaa/bbb"}
end tell
--> document file "aaa/bbb" of folder "Desktop"...

allows to create a file named "aaa/bbb" that appears as such on the Desktop.
On the other hand, doing an ls in the shell, I get:

-rw-r--r-- 1 luttgens luttgens 0 10 Jan 18:19 aaa:bbb

That is, a substitution occured, but with a ":" (quite a nice trick).

Weren't you in fact thinking about the impossibility to create, in the Finder, an item whose name contains a ":"?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Elementary fie naming question
      • From: Walter Ian Kaye <email@hidden>
    • Re: Elementary fie naming question
      • From: Axel Luttgens <email@hidden>
    • Obtaining default Email application name
      • From: Brooks Bell <email@hidden>
References: 
 >Re: Elementary fie naming question (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: parsing Unix date
  • Next by Date: Re: parsing Unix date
  • Previous by thread: Re: Elementary fie naming question
  • Next by thread: Obtaining default Email application name
  • Index(es):
    • Date
    • Thread