在psftp中进行批处理操作

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

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

代码片段:


cd /home/ftp/users/jeff
del jam-old.tar.gz
ren jam.tar.gz jam-old.tar.gz
put jam.tar.gz
chmod a+r jam.tar.gz
quit

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

psftp user@hostname -b myscript.scr

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

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

附命令行帮助:

代码片段:


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

Leave a Reply

Your email address will not be published.