(view source code of filedate.cmd as plain text)
/* FileDate, Version 2.00 */
/* Cloned from the Norton Utilities for DOS */
/* Change date and time attributes of specified files */
/* Copyrights (C) 1999, Rob van der Woude */
/* Initialize RexxUtil */
if RxFuncQuery( "SysLoadFuncs" ) <> 0 then do
call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
call SysLoadFuncs
end
/* Initialize Quercus System's RexxLib */
if RxFuncQuery( "RexxLibRegister" ) <> 0 then do
call RxFuncAdd "RexxLibRegister", "rexxlib", "RexxLibRegister"
call RexxLibRegister
end
/* Defaults */
dateattr = ""
timeattr = ""
newdate = ""
newtime = ""
/* Command line parsing */
parse upper arg parameters
par. = ""
par.0 = 0
do i = 1 by 1 until parameters = ""
parse value parameters with par.i parameters
par.0 = par.0 + 1
end
if par.0 > 1 then do i = 1 to par.0
select
when left( par.i, 2 ) = "/D" then dateattr = substr( par.i, 3 )
when left( par.i, 2 ) = "/T" then timeattr = substr( par.i, 3 )
otherwise filespec = par.i
end
end
else do
call Syntax
end
if dateattr <> "" then do
if length( dateattr ) < 6 then call Syntax
if pos( "-", dateattr ) > 0 then parse value dateattr with dd"-"mm"-"yy
if pos( "/", dateattr ) > 0 then parse value dateattr with dd"/"mm"/"yy
if datatype( yy, "W" ) = 0 then call Syntax
if datatype( mm, "W" ) = 0 then call Syntax
if datatype( dd, "W" ) = 0 then call Syntax
newdate = 19000000 + ( 10000 * yy ) + ( 100 * mm ) + dd
if newdate < 19800000 then newdate = newdate + 1000000
end
if timeattr <> "" then do
if pos( ":", timeattr ) = 0 then call Syntax
if length( timeattr ) < 4 then call Syntax
parse value timeattr with hh":"mn":"ss
select
when pos( "A", mn ) = 0 then nop
when pos( "A", mn ) = 3 then mm = left( mm, 2 )
when pos( "P", mn ) = 0 then nop
when pos( "P", mn ) = 3 then do
mm = left( mm, 2 )
hh = hh + 12
end
otherwise call Syntax
end
if ss = "" then ss = 0
if datatype( hh, "W" ) = 0 then call Syntax
if datatype( mn, "W" ) = 0 then call Syntax
if datatype( ss, "W" ) = 0 then call Syntax
newtime = ( 10000 * hh ) + ( 100 * mn ) + ss
newtime = right( newtime, 6, "0" )
end
call SysFileTree filespec, "file.", "FO"
if exist.0 = 0 then do
say "Invalid filespec or file not found"||"0D0A"X
call Syntax
end
else do i = 1 to file.0
interpret "call dosfdate '"||file.i||"', "||newdate||", "||newtime
end
EXIT
Syntax:
say "FileDate, Version 2.00"
say "Cloned from the Norton Utilities for DOS"
say "Change date and time attributes of specified files"
say "Copyrights (C) 1999, Rob van der Woude"
say
say "Usage: FILEDATE filespec /Ddd/mm/yy /Thh:mm:ss"
exit 255
return
page last modified: 2024-04-16; loaded in 0.0069 seconds