Need a script to automatically create/update a symlink to the most recent directory.
I want to make a shell script which will create or update a symlink (named "current") so that it automatically points to the subdirectory with the most recent date.
For example, given these subdirectories:
2009.03.21_00.50.02
2009.03.21_11.31.42
2009.03.22_07.55.47
2009.03.22_10.59.20
2009.04.03_23.21.38
2009.04.15_11.06.08
2009.04.16_00.50.02
2009.04.18_20.35.26
I want the script to create or update a symlink like this:
current -> 2009.04.18_20.35.26/
the symlink will reside at the same level as the directories 2009.04.18_20.35.26, etc.
When the bash script is run next, if there is a new directory named e.g., 2009.04.20_16.15.06, (and this is the most recent) the symlink should be updated to:
current -> 2009.04.20_16.15.06/