WinSCP典型批处理脚本

使用WinSCP有一个技巧是,可以把FTP动作存为一个脚本,日后如果需要重复这个FTP操作,就只需要运行脚本就可以。 如果我们可以自己写脚本,那就很方便了。 例如,我要把本地文件夹 c:\files\abcd 文件夹上传到两个服务器, 服务器1,firstserver.com目标为 /docker/file/abcd/, 服务器2,secondserver.com目标为 /www/file/abcd/, 并且 只上传新的修改过的,文件一致就跳过(-neweronly), 不上传隐藏文件(ExcludeHiddenFiles=1), 不上传.git .gitattributes等git配置文件(-filemask=""| .gitattributes; .git/""), 那么脚本就可以这么写: @echo off “C:\Program Files (x86)\WinSCP\WinSCP.com” ^ /log=“D:\WinSCP.log” /ini=nul ^ /command ^ “open ftp://user1:[email protected]/ -rawsettings Utf=1 ProxyPort=0” ^ “lcd c:\files” ^ “cd /docker/file/” ^ “put -filemask=”"| .gitattributes; .git/"" -neweronly -rawtransfersettings[1] ExcludeHiddenFiles=1 abcd" ^ “open ftp://user2:[email protected] -rawsettings Utf=1 ProxyPort=0” ^ “lcd c:\files” ^ “cd /www/file/” ^ “put -filemask=”"| .gitattributes; .git/"" -neweronly -rawtransfersettings[1] ExcludeHiddenFiles=1 abcd" ^ “exit” ...

2023-07-30 · 1 min · Duke Yin

How can I stop Filezilla changing my linebreaks?

In FileZilla 2.2.32, go Edit > Settings > File transfer settings > ASCII/Binary. Set it to always binary: that should do the trick. In FileZilla 3.5.0 the setting is in Edit > Settings > Transfers > File Types > Default transfer type > Binary.

2020-05-23 · 1 min · Duke Yin

解决VPS中Wordpress更新或上传需要FTP账号密码

将以下添加到“wp-config.php” /** 解决更新需要FTP。 */ putenv('TMPDIR=' . ini_get('upload_tmp_dir')); if(is_admin()) { add_filter('filesystem_method', create_function('$a', 'return "direct";' )); define( 'FS_CHMOD_DIR', 0751 ); }

2014-12-31 · 1 min · Duke Yin