Skip to content

Instantly share code, notes, and snippets.

@Amunak
Created May 9, 2015 19:46
Show Gist options
  • Save Amunak/36c1dc782588c160c58b to your computer and use it in GitHub Desktop.
Save Amunak/36c1dc782588c160c58b to your computer and use it in GitHub Desktop.
Copies file metadata from source to destination tree
#!/bin/bash
myecho=echo
src_path="$1"
dst_path="$2"
find "$src_path" |
while read src_file; do
dst_file="$dst_path${src_file#$src_path}"
$myecho chmod --reference="$src_file" "$dst_file"
$myecho chown --reference="$src_file" "$dst_file"
$myecho touch --reference="$src_file" "$dst_file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment