script to sort files according to timestamp
I am planning to write a script to sort the directories in a directory according to the timestamp and then cd into that directory . Retrieve the file with the latest time stamp in that directory .
the script so far is:
a=$(ls /home/test/ab/list | wc -l)
echo "number of files is $a"
ls /home/test/ab/list > /home/test/ab/list/nu
exec < /home/test/ab/list/nu
while read line
ls -lt > test
but i dont know why it is not cding into the directory please can you tell me why.
Last edited by aeby; 05-16-2007 at 09:41 AM.