Skip to content

Instantly share code, notes, and snippets.

@amitkeret
Created December 29, 2018 09:48
Show Gist options
  • Save amitkeret/dabe6466fcd4c35c0b09b1d7848e4efa to your computer and use it in GitHub Desktop.
Save amitkeret/dabe6466fcd4c35c0b09b1d7848e4efa to your computer and use it in GitHub Desktop.
Nautilus script - Toggle .dot notation
for file in $NAUTILUS_SCRIPT_SELECTED_URIS; do
file_name=$(echo $file | sed -e 's/file:\/\///g' -e 's/\%20/\ /g' -e 's/.*\///g')
file_folder=$(echo $file | sed -e 's/file:\/\///g' -e 's/\%20/\ /g' -e "s/$file_name//g")
case "$file_name" in
.*)
new_file_name=$(echo $file_name | sed -e 's/\.//')
;;
*)
new_file_name=".$file_name"
;;
esac
mv -v "$file_folder"/"$file_name" "$file_folder"/"$new_file_name"
done
notify-send "Toggle .dot notation complete"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment