Contributed by: Abel McClendon
/* tchdsdfiles.cmd */
/* 'touch directory and sub-directory' */
/* touch always issued with -c option -d so as not to */
/* create any files, just change the date and time */
/* usage: */
/* tchdsd */
/* where */
/* dtochngto= directory to change to */
/* formatted as 'YYYMMDD' */
/* touch this dir and subdirectories and files */
/* to 12am of the date specified */
/* Abel McClendon 030201 */
/*Call Init*/
/*********************************************************/
/* Init - Initializes Stuff */
/*********************************************************/
Init:
parse source . . ThisProgram
ThisDir = FileSpec('D',ThisProgram)||FileSpec('P',ThisProgram)
Tch='touch -c -d'
SlshStar='\*'
/*SlshStar='\*.cmd'
/*SlshStar='\*.php'
Today=Date('S')
return_code =0
If RxFuncQuery('SysLoadFuncs') Then Do
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Call SysLoadFuncs
End
/* get option from cl */
parse arg date_opt
if date_opt = '' then do
return_code=1
Call Exit /* exit return_code */
end
if date_opt > Today then do
return_code=2
Call exit /*exit return_code */
end
dttochngto=strip(date_opt)
/*********************************************************/
/* TouchAllDirs touches all files in all sub directories.*/
/*********************************************************/
TouchAllDirs:
call SysFileTree ThisDir'*','file','SDO'
/* Tch='touch -c -d 03-01-02'*/
say Tch dttochngto ThisDir'*'
Tch dttochngto ThisDir'*'
do i=1 to file.0
Tch dttochngto filespec(drive,file.i)filespec(path,file.i)filespec(name,file.i)
Tch dttochngto filespec(drive,file.i)filespec(path,file.i)filespec(name,file.i)slshstar
end
/*********************************************************/
/* Exit - Exits Cleanly. */
/*********************************************************/
Exit:
if return_code = 0 then say "0 - Completed."
if return_code = 1 then say "1 - No data from cl."
if return_code = 2 then say "2- Date in the future."
if return_code < 0 then say "Whaat??"
if return_code > 2 then say "Whaat??"
exit