FTP経由で日付範囲内のファイルを転送することは可能ですか?

FTP経由で日付範囲内のファイルを転送することは可能ですか?

FTP サーバーから新しいサーバーに大量のファイルを転送する必要があります。ファイルは数千個になる可能性があるので、過去 3 か月以内にアップロードされたファイルに限定したいのですが、それは可能ですか? 可能であれば、どのようにすればよいですか?

また、実際にダウンロードを開始する前に、ダウンロードのサイズがどれくらいになるかを知ることは可能ですか?

ありがとう

答え1

使用できますlftpそのためには、そのmirrorコマンドを使用します。以下は、man ページからの抜粋です。

  mirror [OPTS] [source [target]]

   Mirror specified source directory to local target directory. If target
   directory  ends  with  a  slash,  the source base name is appended to 
   target directory name. Source and/or target can be URLs pointing to 
   directories.


[cut...]
        -N, --newer-than=SPEC    download only files newer than specified time
            --on-change=CMD      execute the command if anything has been changed
            --older-than=SPEC    download only files older than specified time
[...]

には、や などmirrorの便利なオプションがたくさんあるので、必ずマニュアルを参照してください。Lftp は、や などの他のアクセス プロトコルでも動作します。--allow-chown--allow-suid--parallel[=N]sftpfishhttp(s)

答え2

ファイルシステムとしてマウントするには、curlftpfs.
次に、 . を使用してコピーしますfind
例:

mkdir /tmp/mountpoint
curlftpfs ftp://example.com/ /tmp/mountpoint/
cd /tmp/mountpoint
find -mtime +90 -exec cp {} /dest/path/ \;

もっと良い解決策があるのではないかと思います。

関連情報