probedrone Posted October 5, 2006 Share Posted October 5, 2006 how do you rename a file? Link to comment Share on other sites More sharing options...
/dev/null Posted October 5, 2006 Share Posted October 5, 2006 how do you rename a file?FileMove()CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
xcal Posted October 5, 2006 Share Posted October 5, 2006 FileCopy() will also rename a file. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Skruge Posted October 6, 2006 Share Posted October 6, 2006 FileCopy() will also rename a file.No, FileCopy() Copies a file. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
xcal Posted October 6, 2006 Share Posted October 6, 2006 (edited) Yes, it copies a file... and check this out... if the destination name is different, it will also rename it! So, if you want to preserve the original file, it can also come in handy. The difference is that FileMove() removes the original file. Understand, now? (sp) Edited October 6, 2006 by xcal How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
cppman Posted October 6, 2006 Share Posted October 6, 2006 ^ To be technical.. that is NOT renaming. You are renaming a completely different file. A copied version of that file. Not the same one.. Yeah it can come in handy, but FileMove() would be the correct choice for renaming a file. Unless you do, FileCopy($src, $dest) FileDelete($src) lol Miva OS Project Link to comment Share on other sites More sharing options...
xcal Posted October 6, 2006 Share Posted October 6, 2006 (edited) Yes yes... technically. But, I think technically FileMove() isn't just renaming the file when you are using it to rename (just a guess).The reason I mentioned FileCopy() in the first place, is because the help file doesn't point out it will rename a file during the copy. So, you could end up with people doing FileCopy() to a temp dir and then FileMove() to just copy and rename a file. And it was somewhat related to the topic. Edited October 6, 2006 by xcal How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Skruge Posted October 6, 2006 Share Posted October 6, 2006 Yes yes... technically. But, I think technically FileMove() isn't just renaming the file when you are using it to rename (just a guess). The reason I mentioned FileCopy() in the first place, is because the help file doesn't point out it will rename a file during the copy. So, you could end up with people doing FileCopy() to a temp dir and then FileMove() to just copy and rename a file. And it was somewhat related to the topic.Ok, I can see where you might think that... The helpfile entry for FileCopy() is inaccurate, describing the dest parameter as: "The destination path of the copied file(s)." while it should be "The destination path and/or filename of the copied file(s)." Rest assured that FileMove() only renames a file when used as such. The only time a copy/delete is performed is when moving files across volumes. AutoIt Source:// Move or copy operation? if (bMove == true) { if (bDiffVol == false) { bRes = MoveFile(szTempPath, szExpandedDest); } else { // Do a copy then delete (simulated copy) if ( (bRes = CopyFile(szTempPath, szExpandedDest, FALSE)) != FALSE ) bRes = DeleteFile(szTempPath); } } [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now