The purpose of those comands are to find the newest file in a directory acvrdind to system date, and it has to be recursively found in each directory.
The problem is that i want to list in a long format every found file, but the commands i use produce unexpected results ,so the output lists in a long format the files located in the path working directory.
ie
i tried 2 ways but not working
touch -t YYYYMMDD filename. ok
find -newer filename -exec ls -lrt �{} \; � It doesn work
the second trial i used is:
find -newer filename > anotherfile
while read ine
do
ls -lrt "$line"
done < another file
In the above examples keeps listing files located in the path working directory not the desired files (The newest one en each directory)
Why this happens?
id appreciate any help and your support gurus.
Thanks
ie:confused: output
finding out the problem ive got part of the solutionin this way:
find /bmd -type f -newer $anio$mes$dia$hora$minuto -exec ls -lrtd {} \;
(previously definig the variables
Output
-rw-r----- 1 ftp_coll ict 3251584 Dec 9 23:30 /bmd/boboprd/input/BOBOBSC25480920071209233010000.intec
-rw-r----- 1 ftp_coll ict 2518526 Dec 9 23:49 /bmd/boboprd/input/BOBOBSC25481020071209234956000.intec
-rw-r----- 1 ftp_coll ict 454771 Dec 10 00:00 /bmd/boboprd/BOBOBSC25481120071210000004000.intec
-rw-r----- 1 ftp_coll ict 2324852 Dec 10 00:30 /bmd/boboprd/BOBOBSC25481220071210003007000.intec
-rw-r----- 1 ftp_coll ict 2316639 Dec 9 23:23 /bmd/prod/input/ICTBSC36654520071209232300000.intec
-rw-r----- 1 ftp_coll ict 2871303 Dec 9 23:38 /bmd/prod/input/ICTBSC36654620071209233800000.intec
-rw-r----- 1 ftp_coll ict 1730269 Dec 9 23:53 /bmd/prod/input/ICTBSC36654720071209235301000.intec
but i want the output list just one file (the newest one) for each directory
The question is to search for files newer than a reference file created with touch. It seems that the created file with touch don't have the expected created date. The touch command is not used properly, it should be: