Qdig»Touch Dirs

The touchDirs.sh Script

The touchDirs.sh script is a simple little script that uses the touch() command to make all directories in the current directory have a similar timestamp. Why would you want to do this? Because if you are sorting directories by age (so the most recently-modified directory will be first) you may want to "start afresh" with the directories sorted alphabetically.

By default, directories are alpha-sorted, but you can set

 $dir_nav['sort_age']   = TRUE;

to sort them by age instead.

Here is the text of the script:

 # touchDirs.sh
 # Prepare directories using touch(1).  The directories will all have
 # a similar (nearly-identical) timestamp, thus they'll sort by name
 # when they're presented as Qdig gallery directories.
 # Explanation:
 # There's a Qdig setting to sort directories by name, but if
 # you sort them by time-since-modified, (the default setting)
 # this alphabetizes the listing.  When you create new directories,
 # they will appear before the alpha-sorted ones. 

 find . -maxdepth 1 -type d -print0 |xargs -t -0 touch 

 # Qdig project SourceForge.net CVS ID
 # $Id: (...) $
 # vim:set tabstop=4 shiftwidth=4 :