Copy all files from one FTP directory to another
<p>I have to copy all existing files inside one ftp directory to another ftp directory on another server. I have not had any experience writing scripts - so any help with this would be great.</p>

<p>I'm wondering if its possible to write this script so that it happens every day at a specific time?</p>

<p>What software/ language should I use for this? Python is a well renowned one, but I want to make sure it suits my requirements.</p>

<p>Can someone give me a basic code implementation for how to do it?</p>

<p>Thanks in advance</p>

<p>In the end you will probably end up downloading the whole directory to a local machine and re-uploading it to the other, as there's generally no way to copy files between directories in FTP.<br>
See <a href="http://stackoverflow.com/q/3808799/850848">FTP copy a file to another place in same FTP</a>.</p>

<p>You will find plenty of examples for downloading and uploading. You do not even need a scripting language. Simply use some command-line FTP client.</p>

<p>For example with <a href="https://winscp.net/" rel="nofollow">WinSCP FTP client</a>, you can use the following batch file (<code>.bat</code>):</p>

<pre class="lang-none prettyprint-override"><code>winscp.com /log=copy.log /command ^
    "open ftp://username:password@ftp.example.com/" ^
    "get /source/remote/path/* C:\temporary\local\path\" ^
    "put C:\temporary\local\path\* /destination/remote/path/" ^
    "exit"
</code></pre>

<p>See the guide to <a href="https://winscp.net/eng/docs/guide_automation" rel="nofollow">Automating file transfers to and from FTP server</a>.</p>

<p><em>(I'm the author of WinSCP)</em></p>

python shell ftp