Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Copies the last modification date of the specified source to the specified destination.
- 'Source and destination can be a file or a directory.
- if wscript.arguments.count < 2 then
- wscript.echo "Usage: datecopy {source} {destination}"
- wscript.quit 1
- end if
- set fs = createobject("scripting.filesystemobject")
- on error resume next
- set src = fs.getfile(wscript.arguments(0))
- if err.number <> 0 then
- set src = fs.getfolder(wscript.arguments(0))
- if err.number <> 0 then
- wscript.echo "Source file/directory is invalid or not found."
- wscript.quit 2
- end if
- end if
- set dest = fs.getfile(wscript.arguments(1))
- if err.number <> 0 then
- set dest = fs.getfolder(wscript.arguments(1))
- if err.number <> 0 then
- wscript.echo "Destination file/directory is invalid or not found."
- wscript.quit 2
- end if
- end if
- on error goto 0
- set sa = createobject("shell.application")
- set fd = sa.namespace(dest.parentfolder.path)
- set fi = fd.parsename(dest.name)
- fi.modifydate = src.datelastmodified
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement