how to use data variable in mkdir in a linux server with FTP?

那年仲夏 提交于 2019-12-07 07:52:30
auth private

this script seems to be like this topic enter link description here

but you can do it easily by mkdir a new directory on your pc then upload it to your server by this simple script

#!/bin/bash

Your Server credentials

ftp_server='******' 
ftp_username='******' 
ftp_password='******'  

New folder with date in year with month and day

slideshow="`date +'%Y-%m-%d'`" 
new_folder=`mkdir $slideshow` 

Access Your Server via ftp then authenticate to your server

ftp -n $ftp_server <<END_SCRIPT 
quote USER $ftp_username  
quote PASS $ftp_password 

Upload your new created folder

put $new_folder 

then quit

quit  
END_SCRIPT

full script

#!/bin/bash

ftp_server='********'
ftp_username='********'
ftp_password='********'
slideshow="`date +'%Y-%m-%d'`"
new_folder=`mkdir $slideshow`

ftp -n $ftp_server <<END_SCRIPT
quote USER $ftp_username
quote PASS $ftp_password
put $new_folder
quit
END_SCRIPT
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!