The short rad stands for "recursive after date".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
593 B

7 months ago
  1. #!/bin/bash
  2. # create a backup folder in the data directory where you want to recover files, go into the backup folder, and have dir data in same parent dir
  3. SAVEIFS=$IFS
  4. IFS=$(echo -en "\n\b")
  5. find ../data -type f -newermt '1 Feb' -print0 | while read -d $'\0' file
  6. do
  7. dir=`dirname "$file"`
  8. #filename=`basename "$file"`
  9. # dir new without going out two points
  10. dir_new=${dir:3}
  11. mkdir -p "$dir_new"
  12. echo "duplicating $file with its directory.."
  13. cp -p "$file" "$dir_new"
  14. # also touch does the -p option, but better -p
  15. #touch -r "$file" "$dir_new/$filename"
  16. done