Forum Discussion

Howard's avatar
Howard
New Contributor
16 years ago

unexpected result from aqFolderInfo.Rename

I'm trying to use the aqFolderInfo.Rename function to rename folders on the local disk, but I'm getting some unexpected results. What I'm trying to do is simple: rename an existing folder c:\dirA as c:\dirAA. I'm using a script like:




      Set OrigFolder = aqFileSystem.GetFolderInfo(OrigDir)              

      if OrigFolder.Rename(NewDir) Then

        Log.Message("Directory " + OrigDir + " renamed as " + NewDir)

      else

        Log.Message("Failed to rename " + OrigDir + " as " + NewDir)        

      end if 




but with OrigDir set to "C:\dirA" and NewDir set to "C:\dirAA" (and starting with a directory C:\dirA containing only some files) I end up with c:\dirAA\dirA (containing the same files). I just want to simply rename the directory - what's going wrong? I've tried using the functions for the trailing slash, but these either have no effect or cause the rename to fail (e.g. with OrigDir set to "C:\dirA\" and NewDir set to "C:\dirAA\"). Thanks for any help.

 

(using TestComplete 7.51 on Vista 64)




Howard