How to Rename a file or folder

Hi ,

Let me know how to rename a file or folder in VC++ ,i am able to copy file contents but not able to rename a file can can one guide me how to do it ?

i used Filecopy() function,similar to it we have Win API to rename?

Thanks in advance

[269 byte] By [AKJ] at [2008-1-10]
# 1
Code Block

BOOL WINAPI CopyFile(
__in LPCTSTR lpExistingFileName,
__in LPCTSTR lpNewFileName, //This should work...
__in BOOL bFailIfExists
);


I don't know the api for renaming a file, but if you copy the file anyway you can specify it's name right there.
Clockowl at 2007-10-3 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 2
It's MoveFile(existingName, newName). Keep the SDK docs handy when you use the Windows API.
nobugz at 2007-10-3 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...