Skip to content

Instantly share code, notes, and snippets.

@dmpop
Last active April 18, 2023 10:17
Show Gist options
  • Save dmpop/0ff7e12f45e757edd8a060e6d6219d47 to your computer and use it in GitHub Desktop.
Save dmpop/0ff7e12f45e757edd8a060e6d6219d47 to your computer and use it in GitHub Desktop.
iSH-based Bash script
#!/bin/bash
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
# Author: Dmitri Popov, [email protected]
local_dir="/path/to/source/dir"
remote_user="user"
remote_passwd="secret"
remote_server="hello.xyz"
remote_dir="/path/to/remote/dir"
if [ ! -x "$(command -v rsync)" ] || [ ! -x "$(command -v sshpass)" ] || [ ! -x "$(command -v exiftool)" ]; then
echo "Install rsync, sshpass, and exiftool"
exit 1
fi
for file in "$local_dir"/*.jpg; do mv "$file" "$local_dir/$(basename "$file" .jpg).jpeg"; done
#exiftool -d '%Y%m%d-%H%M%S%%-c.%%e' '-filename<CreateDate' "$local_dir"
sshpass -p "$remote_passwd" rsync -avhz --delete -P -e "ssh -p 22" "$local_dir/" "$remote_user"@"$remote_server":"$remote_dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment