PDA

View Full Version : Rename File



smh_2007
03-24-2008, 12:52 PM
Hi To All,

I would like to check during the install if a file exists. I used
If %_SB_INSTALLDIR%\FolderName\FileName.mb File or Folder exists then
Rename File/Folder "%_SB_INSTALLDIR%\FolderName\FileName.mdb" to "%_SB_INSTALLDIR%\FolderName\NewFilename.mdb"
End

The problem is that the rename didn't work, I have an error code of 0. I have manually checked that the old file name exists. There are double quotes around the entire string in both the old and new file/folder fields. Is
%_SB_INSTALLDIR% supposed to be included in quotes? SetupBuilder did put the quotes in automatically.

I am using version 6.7.2163 of SetupBuilder.

Thanks for the help,

Sharon

linder
03-24-2008, 01:56 PM
Sharon,

If the function fails, the return value is zero.

There is no need to put double-quotes around the filenames. SetupBuilder handles this automatically.

Make sure that:

1. %_SB_INSTALLDIR% is defined
2. Your If... Statement is really executed
3. NewFilename.mdb does not already exist
4. Your original filename is not "locked"

Hope this helps.

Friedrich

smh_2007
03-24-2008, 02:26 PM
Hi Freidrich,

Thanks for the info.

I didn't put quotes in myself but, I checked to make sure that the if statement actually executed.

All is well.

Sharon