Created
July 26, 2014 23:51
-
-
Save cabal95/55f4b1d863d5e96df35d to your computer and use it in GitHub Desktop.
Create user-friendly symlinks for rsnapshot names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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