Skip to content

Instantly share code, notes, and snippets.

@cabal95
Created July 26, 2014 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cabal95/55f4b1d863d5e96df35d to your computer and use it in GitHub Desktop.
Save cabal95/55f4b1d863d5e96df35d to your computer and use it in GitHub Desktop.
Create user-friendly symlinks for rsnapshot names
#!/bin/sh
#
DIR="/mnt/servers/snapshots"
#
# Remove all existing symlinks.
#
for f in "$DIR"/*; do
if [ -L "$f" ]; then rm -f "$f"; fi
done
#
# Create new symlinks.
#
for f in "$DIR"/*; do
if [ ! -d "$f" ]; then continue; fi
fmt=`date -r "$f" "+%Y-%m-%d %I.%M%P"`
ln -s "$f" "$DIR/$fmt"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment