Renaming a file in ASP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anthony1312002
    New Member
    • Sep 2006
    • 12

    Renaming a file in ASP

    Hope someone can help me. I'm using ASP and VBScript to import a text file. The original format of the file is this: yyyymmddflatnc3 .txt. During the import can I automatically rename the file so that it is in this format mmddyy? And if yes, how do you do it? Any help would be appreciated.
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Originally posted by Anthony1312002
    Hope someone can help me. I'm using ASP and VBScript to import a text file. The original format of the file is this: yyyymmddflatnc3 .txt. During the import can I automatically rename the file so that it is in this format mmddyy? And if yes, how do you do it? Any help would be appreciated.
    Hi there,

    Yes, it's possible, you need to make use of File Systems Objects (FSO), kindly refer below sample code segment, hope it helps. Good luck & take care.

    Code:
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      objFSO.MoveFile "C:\FSO\ScriptLog.txt" , "C:\FSO\BackupLog.txt"

    Comment

    Working...