Never really used Korn (not very efficient in UNIX either) so this has been painful.
In my current working directory there are files with the following general naming conventions:
SF_AD_MMDDYYnn.DEL
SF_AD_MMDDYYnn.EXP
Ad_sf_MMDDYYnnnnn.DAT
where n represents the number of that particular file sent over on that day.
I would like to write a simple script (I can use AutoSys to kick off the script every day) that will delete all files in that directory that are older than one week. There are other files in the directory that I do not want to touch.
I was thinking, first check the first file in the directory if it is like *MMDDYY*.DEL or *MMDDYY*.EXP or *MMDDYY*.DAT then check the date using some date comparison in an if block. If it is older than one week, delete it, else leave it.
Very overwhelming and the Korn Shell book by Olczak ins't helping me much.
Thanks,
Matt
In my current working directory there are files with the following general naming conventions:
SF_AD_MMDDYYnn.DEL
SF_AD_MMDDYYnn.EXP
Ad_sf_MMDDYYnnnnn.DAT
where n represents the number of that particular file sent over on that day.
I would like to write a simple script (I can use AutoSys to kick off the script every day) that will delete all files in that directory that are older than one week. There are other files in the directory that I do not want to touch.
I was thinking, first check the first file in the directory if it is like *MMDDYY*.DEL or *MMDDYY*.EXP or *MMDDYY*.DAT then check the date using some date comparison in an if block. If it is older than one week, delete it, else leave it.
Very overwhelming and the Korn Shell book by Olczak ins't helping me much.
Thanks,
Matt