Skip to content

Instantly share code, notes, and snippets.

@bouzuya
Created August 3, 2012 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bouzuya/3249349 to your computer and use it in GitHub Desktop.
Save bouzuya/3249349 to your computer and use it in GitHub Desktop.
Option Explicit
Private Function Main()
If Not ValidateArguments() Then
Main = 1
Exit Function
End If
Dim strSrcFile, strDstDir
strSrcFile = WScript.Arguments.Named.Item("srcfile")
strDstDir = WScript.Arguments.Named.Item("dstdir")
Dim strDstPath, strFileName
strFileName = FormatDate(Date())
strDstPath = PathCombine(strDstDir, strFileName)
WScript.Echo("srcfile:" & strSrcFile)
WScript.Echo("dstdir :" & strDstDir)
WScript.Echo("dstpath:" & strDstPath)
WScript.Echo()
WScript.Echo("delete '" & strDstPath & "' if exists.")
Call Delete(strDstPath)
WScript.Echo("copy '" & strSrcFile & "' -> '" & strDstPath & "'.")
Call Copy(strSrcFile, strDstPath)
WScript.Echo("delete old files '" & strDstDir & "'.")
Call DeleteOldFiles(strDstDir, 7)
Main = 0
End Function
WScript.Quit(Main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment