I noticed that the docs say a temporary file can't be renamed.
I think that must be an error in the docs or a misreading of them.
I can't find it, though, where does it say this?
In the online LR under the description of the name property. "It
will rename files if the user has permission to rename them, they
are not in use, and it's not a folder or temporary file."
I think that's an error. In fact, I know it, because I rename temp
files, and I just ran a test that successfully renamed a folder.
f.MoveFileTo tFile //This works fine
tFile.Name = aRequest.filenames(i) //THIS FAILS TO RENAME ends up
with name like Temp-1234
Well, that makes sense. You've moved the file, but tFile is still
pointing to a file with a particular name in the temporary folder.
I've found that I can make it work if I start with a new folderitem
and get the Temp-1234 file by using child with the name
f.MoveFileTo tFile //Again works fine
f2 = tFile.child(f.name) //get new folderitem reference to temp file
f2.Name = aRequest.filenames(i) //This now works???
Makes sense. Now f2 points to the file in its new location.
You could actually do something like this, IIRC:
newFile = f.Child(aRequest.filenames(i))
newFile.MoveFileTo tFile
I could be wrong about that, but I thought I remembered there was
some way to have MoveFileTo do a rename at the same time.
--
-Thomas
Personal web page: <http://homepage.mac.com/thomasareed/>
My shareware: <http://www.bitjuggler.com/>
Free REALbasic code: <http://www.bitjuggler.com/extra/>
There are 10 kinds of people in the world -- those who understand binary
numbers and those who don't.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|