Unanswered: Urgent help : traversing directory tree
I am currently on shell script in which I am trying to traverse a directory tree. All the sub directories and files in this directory uses timestamp as their file/directory names.
Requirement :- Need to run cat command on all the files in current directory in order of its timestamp i.e filename that has latest timestamp as filename is to cat first.......,and so on ....after doing cat to all the files I need to check the sub directories , and need to do cd into the sub -directory that has latest time stamp among the directories as a dirname....after doing cd need to perform same processign as defined above ....like this need to traverse all the directories present in the main directory .....
I am a newbie .....I have tried it ...code looks like :
if [ $? -ne 0 ]
return 0 # Don't have execute permission, return
while read dirname
count=$(($count + 1))
done < ~/tempdir
if [ $count -eq 0 ]
while [ $count_T -lt $count ]
count_T=$(($count_T + 1))
if [ ! -d "$1" ]
echo -e "Please Enter Directory\n"
echo -e "EXITING ....."
I need suggestions from you people ...please advise so that i can learn and make can my script more efficient....any alternate solutions are most welcome....this script is recursive in nature ...is there any iterative solution to the problem becoz this script is consuming lot of time for large directories......