Added CreateFileList

This commit is contained in:
Jeroen De Meerleer 2018-11-30 13:02:34 +01:00
parent 594d6fb157
commit 186070cd24
1 changed files with 21 additions and 0 deletions

View File

@ -95,8 +95,29 @@ VerboseOutput() {
fi
}
CreateFileList() {
# ${1} /mnt/hdd/Example-Artist/Example-Album
# ${2} /mnt/mtp/Example-Artist/Example-Album
# ${3} Example-Artist/Example-Album/
IFS=""
sourcepath="${1}/*"
for file in $sourcepath; do
relfile="${file#"$1/"}"
if [[ -d "${1}/$relfile" ]]; then
newdir="${3}/$relfile"
newdir=${newdir#"/"}
VerboseOutput "Info" "Entering $newdir"
CreateFileList "${1}/$relfile" "${2}/$relfile" "$newdir"
elif [[ ! -f "${2}/$relfile" || "${2}/$relfile" -nt "${1}/$relfile" ]]; then
echo ${3}/$relfile >> /tmp/music-sync-filelist
VerboseOutput "Info" "Added: ${3}/${relfile}"
fi
done
}
GetOptions $@
if [[ "$help" == true ]]; then
Usage
exit
fi
CreateFileList $source $dest ""