Skip to content

Instantly share code, notes, and snippets.

@vim13
Created December 20, 2012 15:53
Show Gist options
  • Save vim13/4346131 to your computer and use it in GitHub Desktop.
Save vim13/4346131 to your computer and use it in GitHub Desktop.
dropboxにアップロードされた最新画像ファイルをFTPアップロード
#!/bin/sh
HOST_NAME="your_host_name"
USER_NAME="your_user_name"
PASSWORD="your_pass_word"
PUT_DIR="www/media/camera/"
cd /your/loca/dir/pass/
for file in *.*
do
mv "$file" `echo $file | tr ' ' '_'`
done
NewestFile=`ls -t1 /your/loca/dir/pass/* | head -1`
ftp -n ${HOST_NAME} << _EOF_
user ${USER_NAME} ${PASSWORD}
bin
cd ${PUT_DIR}
pwd
put ${NewestFile##*/}
rename ${NewestFile##*/} latest_shot.jpg
bye
_EOF_
rm /your/loca/dir/pass/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment