Skip navigation.
 
mlRe: Changing file & directory names
FROM : Sherm Pendley
DATE : Sat Jul 01 21:47:38 2006

On Jul 1, 2006, at 3:18 PM, John Stiles wrote:

> Sherm Pendley wrote:

>> On Jul 1, 2006, at 1:41 PM, Dean Snyder wrote:
>>

>>> Greg Titus wrote at 10:26 AM on Saturday, July 1, 2006:
>>>

>>>> [[NSFileManager defaultManager] movePath:src toPath:dest
>>>> handler:handler];
>>>> Hope this helps!

>>>

>>>> From Apple documentation for NSFileManager movePath:

>>>
>>> "If source is a file, the method creates a file at destination that
>>> holds the exact contents of the original file and then deletes the
>>> original file. If source is a directory, movePath:toPath:handler:
>>> creates a new directory at destination and recursively populates 
>>> it with
>>> duplicates of the files and directories contained in source."
>>>
>>> This is really heavyweight

>>
>> No, it's not heavy at all - you've just misunderstood what it 
>> does. When the above says "creates a file at destination", it's 
>> talking about creating a new directory entry that points to the 
>> same data, not about copying the data.

> I don't see any way that you could read this entry without 
> interpreting it as "directories are copied element-by-element." 
> There's no ambiguity at all.


It's done that way because link() cannot create a hard link to a 
directory. Even so, once the new directory is created, link() 
followed by unlink() are used to move files into it.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Related mailsAuthorDate
mlChanging file & directory names Dean Snyder Jul 1, 19:23
mlRe: Changing file & directory names Greg Titus Jul 1, 19:26
mlRe: Changing file & directory names Dean Snyder Jul 1, 19:41
mlRe: Changing file & directory names Sherm Pendley Jul 1, 20:15
mlRe: Changing file & directory names John Stiles Jul 1, 21:18
mlRe: Changing file & directory names Dean Snyder Jul 1, 21:28
mlRe: Changing file & directory names John Stiles Jul 1, 21:40
mlRe: Changing file & directory names Sherm Pendley Jul 1, 21:41
mlRe: Changing file & directory names Sherm Pendley Jul 1, 21:47
mlRe: Changing file & directory names Dean Snyder Jul 1, 21:57
mlRe: Changing file & directory names John Stiles Jul 1, 22:13
mlRe: Changing file & directory names Sherm Pendley Jul 1, 23:10
mlRe: Changing file & directory names Sherm Pendley Jul 1, 23:19
mlRe: Changing file & directory names Rosyna Jul 2, 02:26
mlRe: Changing file & directory names Derrick Bass Jul 2, 02:28
mlRe: Changing file & directory names Sherm Pendley Jul 2, 03:21
mlRe: Changing file & directory names Dean Snyder Jul 2, 03:39
mlRe: Changing file & directory names Chris Suter Jul 2, 03:47
mlRe: Changing file & directory names Dean Snyder Jul 2, 03:54
mlRe: Changing file & directory names Adam R. Maxwell Jul 2, 09:16
mlRe: Changing file & directory names Matt Neuburg Jul 2, 09:27
mlRe: Changing file & directory names Frode Jul 2, 11:17
mlRe: Changing file & directory names John Stiles Jul 2, 18:20
mlRe: Changing file & directory names Sean McBride Jul 4, 18:07
mlRe: Changing file & directory names Adam R. Maxwell Jul 4, 18:41
mlRe: Changing file & directory names Andy Lee Jul 5, 03:11