1

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.

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

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

Can someone give me a basic code implementation for how to do it?

Thanks in advance

Mark
  • 501
  • 2
  • 11
  • 28
  • 1
    Stack Overflow is not a code writing service. Please read [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve), [what is on-topic](http://stackoverflow.com/help/on-topic) and [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask). You should first find some resources for learning scripting. – Martin Nyolt Sep 08 '16 at 06:59
  • See my answer, though do you really mean *"copy"*? Maybe you actually want to *"move"* the files, don't you? – Martin Prikryl Sep 08 '16 at 07:14

1 Answers1

0

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.
See FTP copy a file to another place in same FTP.

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.

For example with WinSCP FTP client, you can use the following batch file (.bat):

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"

See the guide to Automating file transfers to and from FTP server.

(I'm the author of WinSCP)

Community
  • 1
  • 1
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • it's only a dream if other directory user are different ! Probably returned a `Access Denied` message. – dsgdfg Sep 08 '16 at 07:24
  • 1
    @dsgdfg Sure, but it does not look like the OP wants to copy the files between users. And even if that was required, you just insert another `open` command before the `put`. – Martin Prikryl Sep 08 '16 at 07:26