Renaming Folder With String


I am writing an app that has a backup feature that backs up a folder. Once the backup folder is created, I want to rename the folder so it indicates the date and time of the backup. Sort of time stamp it.

I know you can easily rename a folder by using this code:


But how can I rename it with a string. I have this code:

[code] Dim d as Date
d= New Date
txtDate.Text= d.ShortDate
txtMarker.Text= “Backup” + " " + txtDate.Text + " " + txtTime.Text
Dim M as String


f.Name = M[/code]

This code does not work. Does anyone know what may be going wrong?

Any help would be greatly appreciated.

Probably the ‘ShortDate’ which would be ‘10/20/15’

The slashes can’t be used in a Windows filename since that character is used for the file path delimiter. Replace them with underscores or dashes, or delete them

f.Name =  "BACKEDUP" + str(d.year) + "_" + str(d.month) + "_" + str(


Thank you very much Mark and Jeff. That was the problem. It works great now. Thanks so much for your help!