Renaming Folder in Windows

I am trying to rename a folder, and I’m having a hard time getting it done. It works fine on the Mac, but in Windows, it does not work.

The folder is called RR2. The application that is renaming the folder is contained in the RR2 folder.

The code I’m using is the following:

[code] Dim f2 as folderitem = getfolderitem("").parent.child(“RR2”)

    If f2.Exists Then
          f2.Name =  "RR2  Renamed"
          else
            msgBox "No File Found"
    End If[/code]

As I said, under macOS, its works fine, but not under Windows. It does not give a No File Found message, but it also does not rename it.

I’m not sure what is going on here.

You can not change the name of the current working directory in Windows. It seems starnge to me that it works in macos, if the program ends what is the current working folder on the mac?

What I was doing was to change the name of the folder, and then replacing it with a backup (using other code). The application would then shut down and restart with the new folder. So the idea was to drag and drop a new RR2 folder, but before the drop, the current RR2 folder would be renamed.

Now I know why it does not work.