shell脚本中使用ftp进行文件的上传
来源:互联网 发布:java中间件启动spring 编辑:程序博客网 时间:2024/05/22 15:06
首先,利用脚本随机生成几文件,并往里面写随机数。
#!/bin/bashDIR=./tmpif [ -p $DIR ]then echo "directory ok"else mkdir -p $DIRfinum =$(date +%s+%N)cd $DIRfor ((j=1;j<20;j++))do touch file$j.txt for((i=1;i<1000;i++)) do echo -n "$num" >> file$j.txt donedone通过上面的脚本,可以生成20个,形式如fileXX.txt的文件。
下面看ftp上传文件的脚本。
username="test"password="hello,world"function sendfile{ ftp -n << ! open $2 user $username $password bin passive put $1 $1 quit !}for file in $(ls ./tmp)do sendfile $file 127.0.0.1doneexit 0上面的脚本可以将本地文件上传到本地的ftp服务器指定的目录,ftp下载文件可以将上面的function内容修改为:
ftp -n << !open $2user $usernane $passwordbin passiveget $1quit!}
0 0
- shell脚本中使用ftp进行文件的上传
- linux中使用shell脚本自动登录ftp服务器下载上传文件。
- shell 脚本FTP自动上传文件
- 简单SHELL脚本实现FTP上传文件
- Linux shell中使用ftp自动下载上传文件
- 使用linux 的shell脚本进行sftp文件上传与下载 【转】
- 自动上传FTP服务器的shell脚本
- shell中通过ftp批量上传文件
- Linux下使用Shell脚本向FTP服务器上传或下载一个文件
- shell ftp上传文件
- FTP上传文件脚本
- 在shell脚本中使用ftp telnet
- shell脚本ftp自动上传文件验证成功与否
- 通过FTP自动上传文件到目标机的shell脚本
- ftp 使用脚本上传
- Linux使用Shell脚本实现ftp自动上传
- Linux下使用Shell脚本实现ftp的自动上传下
- linux shell ftp脚本自动上传脚本
- jqgripd隐藏对选checkbox以及caption居中设置
- 张小龙:微信产品观(下)
- Win7系统怎么关闭Java自动更新功能
- Android好奇宝宝_04_一个有3个功能的Adapter
- 八、PYTHON数据库MYSQL的操作
- shell脚本中使用ftp进行文件的上传
- 逆向一些blog收藏
- 如何利用DBMS_LOGMNR包挖掘在线日志
- 密码安全与加密-提升千百倍的密码安全
- MySQL 不能插入中文和显示中文
- C++调用C
- 从system返回值中获得程序退出码
- Radiobutton 设置drawtop图片大小
- IOS学习 ARC下__bridge