Browse Source

first commit

master
alpcentaur 8 months ago
commit
ea196a24b5
3 changed files with 33 additions and 0 deletions
  1. +4
    -0
      README.md
  2. +26
    -0
      rad_extract.bash
  3. +3
    -0
      rad_incect.bash

+ 4
- 0
README.md View File

@ -0,0 +1,4 @@
RAD (recursive after date) is a bash script for keeping two big folders in sync, only copying the last changes after a certain date.
Originally it was created to keep a Nextcloud Twin in sync to a running Nextcloud Instance, for fast recovery.

+ 26
- 0
rad_extract.bash View File

@ -0,0 +1,26 @@
#!/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

+ 3
- 0
rad_incect.bash View File

@ -0,0 +1,3 @@
#!/bin/bash
cp -r data ../

Loading…
Cancel
Save