I have a find command that I am using in a script to list archived files for a given week, starting every Saturday. The script works great, but there is some formatting I would like if possible.
The files listed are archived files, but I don't need the directory name "archive" in my list(as shown under script output).
For the variable I'm using in the find command, I used the function: date +"%b %d" -d "last saturday". This gets me the last saturday just as it states.
Any help or tips would be great.
--USES DAYOFWEEK variable TO GET THE LAST SATURDAY; THEN GETS
--FILES WITH A MODIFED DATE FOR THAT SATURDAY OR NEWER
find . -newermt "$DAYOFWEEK" -printf "%TY-%Tm-%Td %TI:%TM %f\n"
script output
2016-02-01 10:10 dir_name1
2016-02-01 10:10 archive
2016-02-01 07:58 file1.txt
2016-02-01 07:58 file2.txt
2016-02-02 07:58 file3.txt
2016-02-02 07:58 file4.txt
2016-02-01 10:10 dir_name2
2016-02-01 10:10 archive
2016-02-01 07:58 file12.txt
2016-02-01 07:58 file22.txt
2016-02-02 07:58 file32.txt
2016-02-02 07:58 file42.txt
I would like it to be formatted like this(in alphabetical order by client name, then oldest file to newest):
dir_name1
2016-02-01 07:58 file1.txt
2016-02-01 07:58 file2.txt
2016-02-02 07:58 file3.txt
2016-02-02 07:58 file4.txt
dir_name2
2016-02-01 07:58 file12.txt
2016-02-01 07:58 file22.txt
2016-02-02 07:58 file32.txt
2016-02-02 07:58 file42.txt