英文:
How to use `--files-from` `rsync` option to download a list of files?
问题
我正在使用以下命令从远程下载文件夹,使用rsync:
sshpass -p "my_pwd" rsync -av --partial --progress
<usr>@<remote>:/home/remote/folder /home/local/folder/
现在,我想下载文件列表,而不是整个文件夹:我看到可以使用 --files-from
来实现,但不清楚如何使用此选项。
我尝试创建文件,并指定文件,例如:
/home/remote/folder/file1
/home/remote/folder/file2
我还尝试在远程路径前添加:
<usr>@<remote>:/home/remote/folder/file1
<usr>@<remote>:/home/remote/folder/file2
然后分别使用以下命令启动:
sshpass -p "my_pwd" rsync -av --partial --progress --recursive
<usr>@<remote> --files-from=files.txt /home/local/folder/
或者
sshpass -p "my_pwd" rsync -av --partial --progress --recursive
--files-from=files.txt /home/local/folder/
但都没有成功。
有人可以帮助我吗?
英文:
I'm using the following command to download a folder from remote using rsync:
sshpass -p "my_pwd" rsync -av --partial --progress
<usr>@<remote>:/home/remote/folder /home/local/folder/
Now, instead of downloading the entire file I want to download a list of files: I've seen I can do this using the --files-from
but it's not clear how to use this option.
I've tried to create the file by specifying the files, for example:
/home/remote/folder/file1
/home/remote/folder/file2
and I've also tried to preappend the remote:
<usr>@<remote>:/home/remote/folder/file1
<usr>@<remote>:/home/remote/folder/file2
and launch respectively with the command
sshpass -p "my_pwd" rsync -av --partial --progress --recursive
<usr>@<remote> --files-from=files.txt /home/local/folder/
or
sshpass -p "my_pwd" rsync -av --partial --progress --recursive
--files-from=files.txt /home/local/folder/
but neither worked.
Can someone help me out here?
答案1
得分: 1
好的,我找到了指令,我会将问题保留,以便有人需要时可以使用,而不是删除它
sshpass -p "my_pwd" rsync -av --partial --progress --recursive
<usr>@<remote>:/home/remote/folder --files-from=files.txt /home/local/folder/
拥有以下文件
file1
file2
英文:
Ok, I've found the command, I will leave the question in case someone need instead of deleting it
sshpass -p "my_pwd" rsync -av --partial --progress --recursive
<usr>@<remote>:/home/remote/folder --files-from=files.txt /home/local/folder/
having the following file
file1
file2
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论