Skip to content

Instantly share code, notes, and snippets.

@gumblex
Created May 22, 2016 04:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gumblex/5d052064f56c2dcd263edb3e805fbd3a to your computer and use it in GitHub Desktop.
Save gumblex/5d052064f56c2dcd263edb3e805fbd3a to your computer and use it in GitHub Desktop.
Recursively restore file mtime from backup
#!/bin/bash
find . -type f -print0 | while IFS= read -r -d $'\0' filename; do
if [ -f "$1/$filename" ]; then
echo touch -r "$1/$filename" "$filename"
touch -r "$1/$filename" "$filename"
else
echo "$1/$filename" not exist
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment