From 967ee2eb0d803da3b225c15411b54dc349dd45cf Mon Sep 17 00:00:00 2001 From: Weaver Date: Wed, 9 Jan 2019 16:43:53 -0800 Subject: [PATCH 1/2] prevent hidden files --- videoaip | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/videoaip b/videoaip index ab47f7c..90441f5 100755 --- a/videoaip +++ b/videoaip @@ -85,11 +85,12 @@ _error_exit(){ } OPTIND=1 -while getopts "hecl:" opt ; do +while getopts "hecxl:" opt ; do case "${opt}" in h) usage ;; e) runtype="edit";; c) runtype="crop";; + x) hiddenFiles="preserve";; l) logfiles+=("${OPTARG}");; *) esac @@ -232,14 +233,24 @@ while [ "${*}" != "" ] ; do #Run Bagit echo -e "\033[1;32mCreating Bag\033[0m" - bagit baginplace --excludehiddenfiles "$package" + if [ "${hiddenFiles}" = 'preserve' ] ; then + bagit baginplace "$package" + else + find "$package" -type f -iname ".*" -exec rm -f {} \; + bagit baginplace --excludehiddenfiles "$package" + fi + bagit baginplace "$package" #sync AIP to destination if [[ "${sync_choice}" = [yY] ]] ; then for i in "${destination[@]}" ; do if [ -d "${i}" ] ; then echo -e "\033[1;32mSyncing Files to "${i}" \033[0m" - rsync -Pa "$package" "${i}" + if [ "${hiddenFiles}" = 'preserve' ] ; then + rsync -Pa "$package" "${i}" + else + rsync -Pa --exclude ".*" "$package" "${i}" + fi if ! [ "${?}" = "0" ] ; then SYNC_PROBLEM="1" fi From 6015534beca84feca4e755c9117b4899f2fa193e Mon Sep 17 00:00:00 2001 From: Weaver Date: Wed, 9 Jan 2019 16:59:48 -0800 Subject: [PATCH 2/2] fix loop issue --- videoaip | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/videoaip b/videoaip index 90441f5..ab71da3 100755 --- a/videoaip +++ b/videoaip @@ -81,7 +81,6 @@ _set_up_crop(){ _error_exit(){ echo -e "\033[1;32m"$1"\033[0m" 1>&2 - continue } OPTIND=1 @@ -128,8 +127,9 @@ while [ "${*}" != "" ] ; do file_input="${1}" shift - if [ ! -f "$file_input" ]; then - _error_exit "Input could not be found. Please enter valid input." + if [ ! -f "${file_input}" ]; then + _error_exit "Input: ${file_input} could not be found. Please enter valid input." + continue fi #set variables @@ -140,6 +140,7 @@ while [ "${*}" != "" ] ; do if [ -d "${targetdirectory}/${mediaid}" ] ; then _error_exit "Directory already exists. Exiting..." + continue fi #crop mode @@ -165,7 +166,7 @@ while [ "${*}" != "" ] ; do fi #create directory structure - mkdir "${targetdirectory}/${mediaid}" || _error_exit "Directory already exists. Exiting..." + mkdir "${targetdirectory}/${mediaid}" || ( _error_exit "Directory already exists. Exiting..." && continue ) mkdir "${targetdirectory}/${mediaid}/metadata" mkdir "${targetdirectory}/${mediaid}/logs" mkdir "${targetdirectory}/${mediaid}/logs/fileMeta"