Hi Tom, > If you sort first by mtime and second by file name you should find the > right one in all cases, ie, take the latest mtime among the > properly-named files, breaking ties by taking the higher filename. > > It'd probably be better if we had a function to report this, but > you can get along without one. For now I'm using ls with grep: LAST_WAL=$(/bin/ls -t1p $WAL_DIR | /bin/grep -v / | /bin/grep -v backup | /usr/bin/head -1) But a pg function for that would be great. Regards, Guy Naor. -- Family management on rails: http://www.famundo.com - coming soon! My development related blog: http://devblog.famundo.com