FTP move directories

Is there a way to copy a complete directory (files, directories and subdirectories) over stp using a shellscript?
What command do I'll need?
mget * only copy files of the working directory.

My goal:
Copy/move a complete directory from server A to server B.
Is it possible with FTP?

Hello,

Welcome to the forum ! We hope you enjoy your time here, and find this to be a friendly and helpful place.

The short answer is: maybe. Depending on the exact options the FTP server is configured with, and which options and commands your FTP client supports, this might be achievable. You might have to resort to getting a recursive directory listing of all the files and directories at the FTP server end, and then writing a script to go through and retrieve all those files and directories via FTP, which will be a lot of work.

However a better bet would be to use something like rsync to transfer files between two systems these days. Even tarring them up and transferring the tarball over to the destination system via scp and then extracting it would probably be a safer and easier bet than using FTP. Personally I'd only use FTP for server-to-server data transfer these days if I really had no other option at all. And even then, you'd probably be better to tar up the files you wanted, download the tarball via FTP, and then extract it.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.