Using pdksh
stat() command is unavailable on system.
I need to loop through the amount of files found and store their dates in an array. $COMMAND stores the number of files found in $location as can be seen below.
Can someone help me please?
COMMAND=`find $location -type f | wc -l`
CMD_getDate=$(find $location -type f | xargs ls -lrt | awk '{print $6} {print $7}')
Well, first, you don't need to do the
wc. The size of the array will tell you how many there are. Here's a simple way to build an array of dates and names (designed for pdksh; there are better ways to do it in AT&T ksh or bash):Here's one way to examine the results:
This gives you the full date string, not just the month and day. That might be what you want - the date output of
ls -l(orfind -ls) is variable depending on how long ago the file was modified. Given these files, how does your original format distinguish between the modification times ofaandb?As written, the code above would yields this for the above directory with
location=.:It would help if you indicated what the actual end goal is..