-2

copy file and change name to current date .vbs

error line 4:

  1. Set objFSO = CreateObject("Scripting.FileSystemObject")
  2. Dim FSO
  3. Fn=Now()
  4. objFSO.CopyFile "C:\Users\dok\Desktop\test.txt", "C:\Users\dok\Desktop\new folder\1"& Fn & ".txt"
  • 1
    Questions like these are frowned upon on SO because a simple google search would have likely given you the answer. – Rno Aug 29 '23 at 21:02
  • 1
    Replace line 4 with: `MsgBox "C:\Users\dok\Desktop\new folder\1"& Fn & ".txt"` and you should see that you've created an invalid file name (i.e. slashes are not allowed). – LesFerch Aug 29 '23 at 22:50
  • You should name your files using YYYY-MM-DD-HH-MM-SS format (e.g. 2023-08-29-18-53-30.txt). Then they will be valid names that sort correctly. – LesFerch Aug 29 '23 at 22:53

0 Answers0