https://github.com/microuser/Foremost
for instructions see https://github.com/microuser/Foremost/b ... /README.md
I create a discussion here for peer review. For I am sure there are many ways for me to improve this code. Currently, it uses rsync in local mode, where i use the archive mode to merge two similear directory structures.
Code: Select all
#!/bin/bash
#TODO: import that one script i wrote once for auto install.
#sudo apt-get install pv
##TODO: Loop through extra parameters $3...$n while they exist, as well as acceptance for --delete mode
SOURCES=$1
TARGET=$2
#Use ionice as another wrapper for parsing output
RSYNC="ionice -c3 rsync"
#RSYNC_ARGS="-vrltDa --delete --stats --human-readable"
RSYNC_ARGS="-vrltDa --stats --human-readable"
echo "Traversing the filetree while accumulating information about transfer"
RSYNC_FILECOUNT=$(${RSYNC} --dry-run ${RSYNC_ARGS} ${SOURCES} ${TARGET}|grep "^File Count:"|awk '{print $5}')
echo "Beginning RSYNC Transfer"
${RSYNC} ${RSYNC_ARGS} ${SOURCES} ${TARGET} | pv -l -e -p -s "$RSYNC_FILECOUNT"