|
|
-print0 and -0 are the only safe choice
On Unix, there are other "special" characters that cannot be present in file names. Forward slash (/) comes immediately to mind.
-print0 and -0 are the only safe choice
Nope. POSIX only forbids slashes and nulls in filenames. Slashes because they're used for separating components of a pathname, and nulls because system calls that accept pathnames use null-terminated strings. A particular filesystem may have other rules, particularly for non-ASCII characters, but POSIX doesn't say anything about that. It's true that HFS+ doesn't allow colons in filenames, but it does allow slashes. So if you put a colon in a filename, it will be turned into a slash when stored on an HFS+ disk. But when viewed via POSIX-compliant programs, such as "ls", you'll see it as a colon. Try it yourself. Run touch : and then do an ls and see the result. You have a file called ":". Now look at it in the Finder. You'll see a file named "/". Carbon file manipulation APIs use colon-delimited paths, and will see it as a file named "/". Cocoa file manipulation APIs (and traditional BSD APIs) use slash-delimited paths, and will see it as ":". On disk it's stored as "/" if it's a HFS+ disk, or ":" if it's a UFS disk. It will always show up as ":" in command-line programs, but will nearly always show up as "/" in GUI programs. (The exception is in programs where POSIX paths are shown, such as the "Where" field in the Finder's info windows, or in many of the developer tools. Also, in any Cocoa program which shows raw pathnames, instead of using NSFileManager's -displayNameAtPath: method.) --- |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|