u
This commit is contained in:
@@ -24,15 +24,14 @@ log_file="/home/poq/syncDir/0_downloads/tp.log"
|
|||||||
#echo "sync_dir: ${sync_dir}"
|
#echo "sync_dir: ${sync_dir}"
|
||||||
#echo "cwd: ${cwd}"
|
#echo "cwd: ${cwd}"
|
||||||
#echo
|
#echo
|
||||||
echo "---" >> ${log_file}
|
#echo "---" >> ${log_file}
|
||||||
#echo "$@" >> ${log_file}
|
#echo "$@" >> ${log_file}
|
||||||
|
|
||||||
# loop through all files to delete
|
# loop through all files to delete
|
||||||
for input_file in "$@"; do
|
for input_file in "$@"; do
|
||||||
|
|
||||||
# lf file manager sends multiple files as one input parameter, split by with newlines
|
# lf file manager sends multiple files as one input parameter, split by with newlines
|
||||||
|
# https://superuser.com/questions/284187/bash-iterating-over-lines-in-a-variable
|
||||||
|
|
||||||
declare -a theArray
|
declare -a theArray
|
||||||
|
|
||||||
while read -r line
|
while read -r line
|
||||||
@@ -42,46 +41,32 @@ done <<< "$input_file"
|
|||||||
|
|
||||||
for line in "${theArray[@]}"
|
for line in "${theArray[@]}"
|
||||||
do
|
do
|
||||||
echo "$line" >> ${log_file}
|
#echo "$line" >> ${log_file}
|
||||||
#Do something complex here that would break your read loop
|
|
||||||
done
|
|
||||||
|
|
||||||
# while IFS= read -r line; do
|
# if input file has no path specified
|
||||||
# echo "... $line ..."
|
if [[ ${input_file} != *"/"* ]]; then
|
||||||
|
input_file="${cwd}/${input_file}"
|
||||||
|
fi
|
||||||
|
|
||||||
# for line in "$input_file"
|
# substitute parts of the old path, from using the symlink folder, to the non-symlink folder
|
||||||
# do
|
# example:
|
||||||
# echo ${line} >> ${log_file}
|
# "/home/poq/syncDir/0_downloads/topBanner.jpg" > "/home/poq/nextcloud/syncDir/0_downloads/topBanner.jpg"
|
||||||
# done
|
|
||||||
|
|
||||||
# while IFS= read -r line; do
|
|
||||||
# echo "... $line ..."
|
|
||||||
# done <<< "$list"
|
|
||||||
|
|
||||||
|
|
||||||
# for input_file in
|
|
||||||
|
|
||||||
# # if input file has no path specified
|
|
||||||
# if [[ ${input_file} != *"/"* ]]; then
|
|
||||||
# input_file="${cwd}/${input_file}"
|
|
||||||
# fi
|
|
||||||
#
|
#
|
||||||
# # substitute parts of the old path, from using the symlink folder, to the non-symlink folder
|
# please note, if a file outside of the sync directory is tp'ed, then the replacement will not happen.
|
||||||
# # example:
|
# this is great, as trash-put should work normally outside of the sync-dir. and for files residing outside,
|
||||||
# # "/home/poq/syncDir/0_downloads/topBanner.jpg" > "/home/poq/nextcloud/syncDir/0_downloads/topBanner.jpg"
|
# no replacemant should be done.
|
||||||
# #
|
|
||||||
# # please note, if a file outside of the sync directory is tp'ed, then the replacement will not happen.
|
# new_file=${original_string//old_substring/new_substring}
|
||||||
# # this is great, as trash-put should work normally outside of the sync-dir. and for files residing outside,
|
new_file=${input_file//$sync_dir_sym/$sync_dir}
|
||||||
# # no replacemant should be done.
|
|
||||||
#
|
if [[ -f "${new_file}" ]] || [[ -d "${new_file}" ]] ; then
|
||||||
# # new_file=${original_string//old_substring/new_substring}
|
#trash-put "${new_file}"
|
||||||
# new_file=${input_file//$sync_dir_sym/$sync_dir}
|
|
||||||
#
|
|
||||||
# if [[ -f "${new_file}" ]] || [[ -d "${new_file}" ]] ; then
|
|
||||||
# #trash-put "${new_file}"
|
|
||||||
#echo "${new_file}"
|
#echo "${new_file}"
|
||||||
# else
|
echo "${new_file}" >> ${log_file}
|
||||||
# echo "error: unable to delete \"${new_file}\""
|
else
|
||||||
# fi
|
echo "error: unable to delete \"${new_file}\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user