script to sort files according to timestamp
Hi ,
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:
#!/bin/sh
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
do
cd $line
ls -lt > test
done
but i dont know why it is not cding into the directory please can you tell me why.
Regards,
Arsha
Last edited by aeby; 05-16-2007 at 09:41 AM.
|