rename file
-
I would like rename a file to the current date.Any idea on how to do this? The file is text file. Thank You,
The following code uses the Scripting.FileSystemObject to rename the file specified in strFilePath to the format out mm-dd-yyyy.txt . Ex. for today, the file would be named 04-23-2001.txt Hope this helps Dim strFilePath As String Dim strNewFileName As String Dim fso As FileSystemObject Dim file As File strFilePath = "c:\myText.txt" strNewFileName = Format(Now(), "mm-dd-yyyy") & ".txt" Set fso = New FileSystemObject Set file = fso.GetFile(strFilePath) file.Name = strNewFileName Set file = Nothing Set fso = Nothing Jason Gerard MCSD, MCSE Technology Point International, Inc.
-
The following code uses the Scripting.FileSystemObject to rename the file specified in strFilePath to the format out mm-dd-yyyy.txt . Ex. for today, the file would be named 04-23-2001.txt Hope this helps Dim strFilePath As String Dim strNewFileName As String Dim fso As FileSystemObject Dim file As File strFilePath = "c:\myText.txt" strNewFileName = Format(Now(), "mm-dd-yyyy") & ".txt" Set fso = New FileSystemObject Set file = fso.GetFile(strFilePath) file.Name = strNewFileName Set file = Nothing Set fso = Nothing Jason Gerard MCSD, MCSE Technology Point International, Inc.