通过FTP传输目录,但只传输图像和视频

问题描述 投票:-2回答:1

你可以帮我一个命令通过ftp图像发送到远程目录...例如我有这个文件系统:

/directory
    image.png
    index.php
    index.html
    video.mpeg
/directory2
    image.jpg
    index.html
/directory3
    /directory
        index.html
        image.jpg

当我运行命令时,我想传输具有特定扩展名的文件(现在是jpg,png和mpeg),所以我对远程文件夹的期望结果是:

/directory
    image.png
    video.mpeg
/directory2
    image.jpg
/directory3
    /directory
        image.jpg

有没有可以做到这一点的命令?

linux ftp command
1个回答
0
投票

假设这些只是通用的* nix系统,那么rsyncftp更适合这种任务,例如:

rsync -av path/ remote-system:path/ --include \*/ --include \*.jpg --include \*.png --include \*.mpeg --exclude \*
© www.soinside.com 2019 - 2024. All rights reserved.