Jump to content

rename files?


Recommended Posts

how do you rename a file?

FileMove()

Cheers

Kurt

__________________________________________________________(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

^

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)

:lmao:

lol

Link to comment
Share on other sites

Yes yes... technically. :lmao: 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 by xcal
Link to comment
Share on other sites

Yes yes... technically. :lmao: 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...