使用FTP递归将文件放置到远程服务器中

问题描述 投票:3回答:5

我目前处于对服务器的访问权限非常有限的状态,但是需要上载和下载单个目录结构中包含的大量文件。我没有SSH访问权限,所以我不能使用SCP-不幸的是,rsync也不是一种选择。

我当前正在使用ncftpput,这很好,但是似乎很慢(尽管连接很快)。

有没有其他我可以研究的/更好的方法?

(如果已解决,请接受我的歉意,我在发布之前进行了快速搜索,但未找到任何能明确回答我问题的内容)]] >>

我目前处于对服务器的访问权限非常有限的状态,但是需要上载和下载单个目录结构中包含的大量文件。我没有...

recursion ftp data-transfer put ftp-client
5个回答
4
投票

2
投票

如果连接良好,建议您通过GNOME或KDE文件管理器安装ftp服务器,或者使用CurlFtpFS。然后,您可以将其视为另一个文件夹。


1
投票

我对ncftpput不熟悉。对于非交互式FTP,我一直使用Perl Net :: FTP模块-http://perldoc.perl.org/Net/FTP.html


0
投票

由于我总是总是对此有疑问,因此我将在此处发布我的笔记:


0
投票

没有提及#!/usr/bin/env bash set -x # change these to match your installations: FTPSRVCLIPATH="/path/to/pyftpdlib" FTPSYNCPATH="/path/to/ftpsync" { echo "Recreate directories; populate loctest, keep srvtest empty:"; } 2>/dev/null sudo rm -rf /tmp/srvtest /tmp/loctest mkdir /tmp/srvtest mkdir -p /tmp/loctest/.git echo aaa > /tmp/loctest/tempa1.txt echo aaa > /tmp/loctest/.git/tempa2.txt { echo "show dirs:"; } 2>/dev/null tree --noreport -a /tmp/srvtest /tmp/loctest { echo -e "\n*NOTE, rsync can automatically figure out parent dir:"; } 2>/dev/null rsync -a --exclude '*.git*' /tmp/loctest /tmp/srvtest/ { echo "show dirs:"; } 2>/dev/null tree --noreport -a /tmp/srvtest /tmp/loctest { echo "cleanup:"; } 2>/dev/null rm -rf /tmp/srvtest/* { echo -e "\nStart a temporary ftp server:"; } 2>/dev/null # https://askubuntu.com/questions/17084/how-do-i-temporarily-run-an-ftp-server sudo bash -c "python $FTPSRVCLIPATH/ftpserver-cli.py --username=user --password=12345 --directory=/tmp/srvtest &" sleep 1 { echo "test with lftp:"; } 2>/dev/null # see http://russbrooks.com/2010/11/19/lftp-cheetsheet # The -R switch means "reverse mirror" which means "put" [upload]. { echo -e "\n*NOTE, lftp syncs *contents* of local dir (rsync-like syntax doesn't create target dir):"; } 2>/dev/null lftp -e 'mirror -R -x ".*\.git.*" /tmp/loctest / ; exit' -u user,12345 127.0.0.1 { echo "show dirs:"; } 2>/dev/null tree --noreport -a /tmp/srvtest /tmp/loctest { echo "cleanup:"; } 2>/dev/null rm -rf /tmp/srvtest/* { echo -e "\n*NOTE, specify lftp target dir explicitly (will be autocreated):"; } 2>/dev/null lftp -e 'mirror -R -x ".*\.git.*" /tmp/loctest /loctest ; exit' -u user,12345 127.0.0.1 { echo "show dirs:"; } 2>/dev/null tree --noreport -a /tmp/srvtest /tmp/loctest { echo "cleanup:"; } 2>/dev/null sudo rm -rf /tmp/srvtest/* { echo -e "\n*NOTE, ftpsync syncs *contents* of local dir (rsync-like syntax doesn't create target dir); also info mode -i is buggy (it puts, although it shouldn't):"; } 2>/dev/null { echo -e "\n*NOTE, ftpsync --ignoremask is for older unused code; use --exclude instead (but it is buggy; need to change ` 'exclude=s' => \$opt::exclude,` in source)"; } 2>/dev/null $FTPSYNCPATH/ftpsync -i -d --exclude='.*\.git.*' /tmp/loctest ftp://user:[email protected]/ { echo "show dirs:"; } 2>/dev/null tree --noreport -a /tmp/srvtest /tmp/loctest { echo "cleanup:"; } 2>/dev/null sudo rm -rf /tmp/srvtest/* { echo -e "\n*NOTE, specify ftpsync target dir explicitly (will be autocreated):"; } 2>/dev/null $FTPSYNCPATH/ftpsync -i -d --exclude='.*\.git.*' /tmp/loctest ftp://user:[email protected]/loctest { echo "show dirs:"; } 2>/dev/null tree --noreport -a /tmp/srvtest /tmp/loctest { echo "cleanup:"; } 2>/dev/null sudo rm -rf /tmp/srvtest/* sudo pkill -f ftpserver-cli.py { set +x; } 2>/dev/null

© www.soinside.com 2019 - 2024. All rights reserved.