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

#!/bin/bash
# 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
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
find ../data -type f -newermt '1 Feb' -print0 | while read -d $'\0' file
do
dir=`dirname "$file"`
#filename=`basename "$file"`
# dir new without going out two points
dir_new=${dir:3}
mkdir -p "$dir_new"
echo "duplicating $file with its directory.."
cp -p "$file" "$dir_new"
# also touch does the -p option, but better -p
#touch -r "$file" "$dir_new/$filename"
done