This is how it looks since yesterday (sorry I did not update it earlier). I believe that the -f DATEN and -f DATE2 does not work because I need to compare what truss outputs to the DATEN and DATE2
All I want to do is have it print "file not found: for each directory in which it does not find any matching date. So far it will print that message when any file in any directory does not match the date, so I will get 10 -15 prints in each directory of the message
DATEN=$(perl -e 'print scalar(localtime(time - 0 * 24 * 60 * 60)), "\n";' |awk '{print $2,$3,$5}')
DATE2=$(perl -e 'print scalar(localtime(time - 2 * 24 * 60 * 60)), "\n";' |awk '{print $2,$3,$5}')
]for i in * ; do (cd $i; echo $i; for f in `ls *.txt`;
do
file=$(truss -vlstat -tlstat ls -l $f 2>&1 |awk 'NR==4'|gawk '{print $3, $4, $7}')
if [ -f "$DATEN" ] && [ -f "$DATE2" ];
then echo "$file" >/dev/null
else echo "YES"
fi
done)
done[
---------- Post updated at 09:58 AM ---------- Previous update was at 09:47 AM ----------
Also, it would help if I could search on "does the file match the date". would this be
[ "$file" = "$DATEN" ] || [ "$file" = "$DATE2" ]
would that mean if the file matchies date 1 or if it matches date2?
---------- Post updated at 10:17 AM ---------- Previous update was at 09:58 AM ----------
Is there a way to echo a message just once and send the rest to /dev/null ?
So that there would be just one message printed for each directory?
---------- Post updated at 11:03 AM ---------- Previous update was at 10:17 AM ----------
also the previous post you made appears to work somewhat:
for i in * do echo $i for f in "$Z" "$Z1" "$Z2" "$Z3" "$Z4" "$Z5" "$Z6" do if [ -f "$i/$f" ] then echo "it is there" continue 2 fi done echo "NO" done
but it echos yes for everything even though there are no matching files, this
is because I am trying to compare what is in truss command not "do the files exist or not"