Add 'process-dir'

master
Kar 2022-11-21 20:17:09 +01:00
parent 32e4d44ac1
commit 49d5d2298a
1 changed files with 34 additions and 0 deletions

34
process-dir Normal file
View File

@ -0,0 +1,34 @@
if (( $# !=2 )); then
echo "input folder and output folder needed without trailing slash"
exit 1
fi
timestamp=$(date +%s)
shopt -s globstar
for f in $1/**; do
#echo "$f"
if test -f "$f"; then
fName="$(basename -- ${f})"
fDir="$(dirname -- ${f})"
#fSrc="$1/${f}"
fDst="$2/${fDir}"
dDir="$(dirname -- ${fDst})"
if [ "${fName: -4}" == ".wmv" ]; then
fName="${fName}.webm"
echo "${f}" >> log/wmv-"${timestamp}".list
elif [ "${fName: -4}" == ".mp4" ]; then
fName="${fName}.webm"
echo "${f}" >> log/mp4-"${timestamp}".list
else
echo "${f}" >> log/other-"${timestamp}".list
#cp --parents "${f}" "${fDst}"
fi
mkdir -p "${fDst}" && cp "${f}" $_
#echo -e "${f}\n" "${fDst}\n" "${fName}\n\n"
#cp --parents "${f}" "${fDst}"
fi
done