Renaming Folder With String

Hi,

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:

f.Name="My_New_Name"

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
txtTime.text=d.Shorttime
txtMarker.Text= “Backup” + " " + txtDate.Text + " " + txtTime.Text
Dim M as String

M=txtMarker.Text

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(d.day)

?

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