Last active
August 29, 2015 14:22
-
-
Save mikehale/7a66ba17ba9f074046d9 to your computer and use it in GitHub Desktop.
restore old syncthing versions
This file contains 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
# Specific dir | |
cd ~/Sync/.stversions | |
cp foo ~/Sync/foo | |
cd ~/Sync/foo | |
find . -name '*~20150604*' -type f |ruby -rfileutils -e 'mappings = STDIN.read.split($/).map{|s| s =~ /^(.+)~\d{8}-\d{6}(.*)/; d = [$1, $2].join; [s,d]}; mappings.each{|s,d| FileUtils.mv(s,d, noop: false, verbose: true)}' | |
# Scan for version files | |
cd ~/Sync | |
find . ! -path './.stversions/*' -name '*~20150604*' -type f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment