+ tp (tp.sh)
abbreviation for trash-put - a command for handling using a symlink directory, which leads to error when trying to delete file. for more info, see https://askubuntu.com/questions/616092/impossible-to-trash-files-from-a-folder-which-is-a-symbolic-link-to-a-ntfs-parti .
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
Name=trash-put
|
Name=trash-put
|
||||||
GenericName=trash-put
|
GenericName=trash-put
|
||||||
Icon=system-error
|
Icon=system-error
|
||||||
Exec=trash-put
|
Exec=tp.sh
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=System;FileTools;FileManager
|
Categories=System;FileTools;FileManager
|
||||||
@@ -38,12 +38,13 @@ ex ()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
alias ffind="sudo find / -type f -name"
|
|
||||||
alias keymap="setxkbmap -model pc105 -layout us,no -option grp:caps_toggle,grp_led:scroll"
|
|
||||||
alias nr="nitrogen --restore"
|
|
||||||
alias myip="echo $(wget http://ipinfo.io/ip -qO -)"
|
|
||||||
alias curae="sudo curae"
|
alias curae="sudo curae"
|
||||||
|
alias ffind="sudo find / -type f -name"
|
||||||
alias gparted="sudo gparted"
|
alias gparted="sudo gparted"
|
||||||
|
alias keymap="setxkbmap -model pc105 -layout us,no -option grp:caps_toggle,grp_led:scroll"
|
||||||
|
alias myip="echo $(wget http://ipinfo.io/ip -qO -)"
|
||||||
|
alias nr="nitrogen --restore"
|
||||||
|
alias tp="tp.sh"
|
||||||
|
|
||||||
nmrestart() {
|
nmrestart() {
|
||||||
systemctl restart NetworkManager
|
systemctl restart NetworkManager
|
||||||
|
|||||||
30
dots/bin/tp.sh
Executable file
30
dots/bin/tp.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# klevstul :: 24.06
|
||||||
|
|
||||||
|
this_file_name=`basename "$0"`
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "error: path to file is missing."
|
||||||
|
echo "usage: '$this_file_name [path_to_file]'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
input_file=$1
|
||||||
|
|
||||||
|
sync_dir_sym=/home/${USER}/syncDir
|
||||||
|
syncdir_env_var=SYNCDIR_${HOSTNAME}
|
||||||
|
sync_dir=${!syncdir_env_var} # '!' to use the name and not the value
|
||||||
|
|
||||||
|
#echo ${input_file}
|
||||||
|
#echo ${sync_dir_sym}
|
||||||
|
#echo ${sync_dir}
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
#
|
||||||
|
# new_file=${original_string//old_substring/new_substring}
|
||||||
|
new_file=${input_file//$sync_dir_sym/$sync_dir}
|
||||||
|
|
||||||
|
if [ -f ${new_file} ] ; then
|
||||||
|
trash-put ${new_file}
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user