u
This commit is contained in:
@@ -15,6 +15,7 @@ sync_dir=${!syncdir_env_var} # '!' to use the name and not the value
|
|||||||
cwd=$(pwd)
|
cwd=$(pwd)
|
||||||
|
|
||||||
# nifty for debugging:
|
# nifty for debugging:
|
||||||
|
log_file="/home/poq/syncDir/0_downloads/tp.log"
|
||||||
#echo
|
#echo
|
||||||
#echo "debugging values:"
|
#echo "debugging values:"
|
||||||
#echo "input args: $@"
|
#echo "input args: $@"
|
||||||
@@ -23,32 +24,43 @@ cwd=$(pwd)
|
|||||||
#echo "sync_dir: ${sync_dir}"
|
#echo "sync_dir: ${sync_dir}"
|
||||||
#echo "cwd: ${cwd}"
|
#echo "cwd: ${cwd}"
|
||||||
#echo
|
#echo
|
||||||
echo "$@" >> /home/poq/syncDir/0_downloads/tp.log
|
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
|
||||||
|
|
||||||
# if input file has not path specified
|
# lf file manager sends multiple files as one input parameter, split by with newlines
|
||||||
if [[ ${input_file} != *"/"* ]]; then
|
# while IFS= read -r line; do
|
||||||
input_file="${cwd}/${input_file}"
|
# echo "... $line ..."
|
||||||
fi
|
|
||||||
|
|
||||||
# substitute parts of the old path, from using the symlink folder, to the non-symlink folder
|
while read input_file ; do
|
||||||
# example:
|
echo === $input_file ===
|
||||||
# "/home/poq/syncDir/0_downloads/topBanner.jpg" > "/home/poq/nextcloud/syncDir/0_downloads/topBanner.jpg"
|
done
|
||||||
#
|
|
||||||
# please note, if a file outside of the sync directory is tp'ed, then the replacement will not happen.
|
|
||||||
# this is great, as trash-put should work normally outside of the sync-dir. and for files residing outside,
|
|
||||||
# no replacemant should be done.
|
|
||||||
|
|
||||||
# new_file=${original_string//old_substring/new_substring}
|
# for input_file in
|
||||||
new_file=${input_file//$sync_dir_sym/$sync_dir}
|
|
||||||
|
|
||||||
if [[ -f "${new_file}" ]] || [[ -d "${new_file}" ]] ; then
|
# # if input file has no path specified
|
||||||
#trash-put "${new_file}"
|
# if [[ ${input_file} != *"/"* ]]; then
|
||||||
echo "${new_file}"
|
# input_file="${cwd}/${input_file}"
|
||||||
else
|
# fi
|
||||||
echo "error: unable to delete \"${new_file}\""
|
#
|
||||||
fi
|
# # substitute parts of the old path, from using the symlink folder, to the non-symlink folder
|
||||||
|
# # example:
|
||||||
|
# # "/home/poq/syncDir/0_downloads/topBanner.jpg" > "/home/poq/nextcloud/syncDir/0_downloads/topBanner.jpg"
|
||||||
|
# #
|
||||||
|
# # please note, if a file outside of the sync directory is tp'ed, then the replacement will not happen.
|
||||||
|
# # this is great, as trash-put should work normally outside of the sync-dir. and for files residing outside,
|
||||||
|
# # no replacemant should be done.
|
||||||
|
#
|
||||||
|
# # new_file=${original_string//old_substring/new_substring}
|
||||||
|
# new_file=${input_file//$sync_dir_sym/$sync_dir}
|
||||||
|
#
|
||||||
|
# if [[ -f "${new_file}" ]] || [[ -d "${new_file}" ]] ; then
|
||||||
|
# #trash-put "${new_file}"
|
||||||
|
# echo "${new_file}"
|
||||||
|
# else
|
||||||
|
# echo "error: unable to delete \"${new_file}\""
|
||||||
|
# fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user