Skip to content

Instantly share code, notes, and snippets.

@mikehale
Last active August 29, 2015 14:22
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 mikehale/7a66ba17ba9f074046d9 to your computer and use it in GitHub Desktop.
Save mikehale/7a66ba17ba9f074046d9 to your computer and use it in GitHub Desktop.
restore old syncthing versions
# 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