• 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: Rename files containing a slash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rename files containing a slash


  • Subject: Re: Rename files containing a slash
  • From: Howard Oakley <email@hidden>
  • Date: Mon, 21 Oct 2002 19:30:34 +0100

On 21/10/02 19:19, Lorenzo Puleo wrote:

> I'm trying to rename a file using a new filename containing a slash.
> Since I can't find a Cocoa API that renames files I use the Carbon API:
> err = FSRenameUnicode(&destRef, nameLength, name, theInfo.textEncodingHint,
> nil);
>
> Each time the fileName proposed contains a slash (that Finder accepts) this
> API returns an error. Please may someone help me to fix the trouble?
> Thank you.

Lorenzo,

The error is that you cannot and must not put a slash in a filename in OS X.
(Yes, I know that some things in the past have done so, but this has from
the Public Beta been a bad move.)

This is because the slash is the BSD separator in paths. OS X is unable to
distinguish between a file called this/that and a file called that in the
folder this.

The same applies to OS X's other separator (from its Mac heritage), the
colon - it also causes confusion in paths.

If you want to verify this, try editing a file name in the Finder (in Jaguar
or later - 10.0 and 10.1 did not object so strongly!) to contain these
characters.

One other character to avoid is a trailing hash # followed by anything that
could appear to be hexadecimal, e.g. this#dead - this is a bug affecting
10.2 and 10.2.1, though, and not intentional.

Howard.

Dr Howard Oakley * email@hidden
EHN & DIJ Oakley * email@hidden
Brooklands Lodge * GPRS email email@hidden
Park View Close * mobile (& SMS) +44 7811 326837
Wroxall, Ventnor * home voice +44 1983 853605
Isle of Wight, PO38 3EQ, UK * http://www.quercus.demon.co.uk
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Rename files containing a slash
      • From: Rosyna <email@hidden>
    • Re: Rename files containing a slash
      • From: Howard Oakley <email@hidden>
References: 
 >Rename files containing a slash (From: Lorenzo Puleo <email@hidden>)

  • Prev by Date: copyPath API: still error
  • Next by Date: Re: Rename files containing a slash
  • Previous by thread: Rename files containing a slash
  • Next by thread: Re: Rename files containing a slash
  • Index(es):
    • Date
    • Thread