Search code examples
bashfindlftp

Can lftp execute a command on the downloaded files (as part of the mirroring process)?


This may be asking too much from an already very powerful tool, but is there a chance that lftp mirror can execute a command during the mirroring process (from remote directory to the local machine)?

Specific example: lftp is asked to mirror a remote directory with xml files into a local folder and as soon as each file is downloaded/updated, it converts the file to JSON format using xml2json.

I can think of a solution that relies on monitoring the local copy of the mirrored folder for changes via find and then executing xml2json on the new/updated files, but perhaps there is a simpler way?


Solution

  • You can use xfer:verify and xfer:verify-command settings to run a local command on every transferred file.