On Feb 27, 2007, at 1:40 AM, Guyren Howe wrote:
> I am attempting to move a file into the temp folder.
>
> I get a folderItem for a file inside the temp folder. This folderItem
> doesn't exist.
>
> I do foo.MoveFileTo theTempFileThatDoesntExist
>
> This gives me a foo.LastErrorCode = 105 ("Invalid name") and the file
> doesn't move.
>
> I *hypothesize* that I can only move a file to a folder, not to a
> file. I can sometimes get moving to a file to work, but I sometimes
> get the 105 (can't find a pattern).
>
> So then I try to do:
>
> foo.MoveFileTo TheTempFileThatDoesntExist.Parent
> too.Name = TheTempFileThatDoesntExist.Name
>
> And this works on the Mac but fails on Windows. Sometimes...
>
> I've wound up doing a #If TargetMacOS that does the the two-step move-
> rename on the Mac and the single-step move on Windows, and that
> appears to work.
>
> Is this all just sadly inconsistent between platforms, or am I
> missing something, or what?
It's probably platform-dependent. Presumably on Windows MoveFileTo
ultimately calls the Windows API function MoveFile, or perhaps
MoveFileEx. You might try declaring one of those functions to see if
you can reproduce the behavior of FolderItem.MoveFileTo.
------------------------
Charles Yeomans
http://www.declareSub.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>