在psftp中进行批处理操作

在psftp(sftp的命令行客户端)中进行批处理操作:

1.首先建立文件->myscript.scr,内容如下:

代码片段:

<font color="#000000">
cd /home/ftp/users/jeff<br />del jam-old.tar.gz<br />ren jam.tar.gz jam-old.tar.gz<br />put jam.tar.gz<br />chmod a+r jam.tar.gz<br />quit</font>

2.然后你可以运行下面命令行:

psftp user@hostname -b myscript.scr

myscript.scr中所写的内容就会执行下去

3.有什么用呢?在windows下写个批处理.bat,配合editplus上传文件,爽翻你

附命令行帮助:

代码片段:

<font color="#000000">
PuTTY Secure File Transfer (SFTP) client<br />Release 0.56<br />Usage: psftp [options] [user@]host<br />Options:<br />  -b file   use specified batchfile<br />  -bc       output batchfile commands<br />  -be       don't stop batchfile processing if errors<br />  -v        show verbose messages<br />  -load sessname  Load settings from saved session<br />  -l user   connect with specified username<br />  -P port   connect to specified port<br />  -pw passw login with specified password<br />  -1 -2     force use of particular SSH protocol version<br />  -C        enable compression<br />  -i key    private key file for authentication<br />  -batch    disable all interactive prompts<br />  -V        print version information</font>

作者: 发表于August 3, 2002 at 8:33 am

版权信息: 可以任意转载, 转载时请务必以超链接形式标明文章原始出处作者信息及此声明

Tags:

留条评论