The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 01-18-2008
faltooweb faltooweb is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 11
I found this while searching for fast filename expansion ideas.

I know this is very old message, but thought it should be put to a close.
Here is one way to achieve the result.

ls -rt $dir1/*.xml $dir2/*.xml $dir3/*.xml

This will sort files from all directories matching "*.xml", with the oldest first.
If your directory list is a variale list then you may try the following.
Assuming input variable as "IN_VAR" containing list of dirs.

DIR_LIST=`echo $IN_VAR | sed 's, ,/*.xml ,g; s,,$/*.xml,'`

echo "$DIR_LIST"

ls -rt $DIR_LIST