I'm using ncftpput to upload local file in my Linux server to FTP. Is there any way to do the same but move files\directories withing the FTP? As I've mentioned in the title?

I do aware for the solution of "ncftp rename" but it's not good for me as I can't use it in the my bash scripts.

ncftpput is great for upload local files but it's not supporting moving\coping files from remote-dir to remote-dir.

If you have any equivalent\alternatives for ncftpput please share.

Thanks in advance, EddieM

  • are you only capable of connecting to this server via ftp or can you connect using ssh as well ?
    – MelBurslan
    Mar 24, 2016 at 14:21
  • The FTP is a windows server. So no, there is not ssh available.
    – EddieM
    Mar 24, 2016 at 14:24

2 Answers 2


Unless there is a reason that you didn't disclose, for using ncftp instead of plain ftp, you can do this by using the plain old ftp in a script, as such:


ftp $HOST <<EOC
user $USER

# go on with your bash script from this point on 
  • Hi Mel, it look like something I can work with. I will check it and update. Thanks for the help.
    – EddieM
    Mar 24, 2016 at 15:54
  • Does it work with moving whole directory? and not only files?
    – EddieM
    Mar 28, 2016 at 8:28
  • I believe rename command of ftp only works on single files. You will need to build in some intelligence into the script to do the renaming of all the files in the directory, one by one. It is not an effective method for massive file operations.
    – MelBurslan
    Mar 28, 2016 at 13:25

You can take advantage of Fuse

Create 2 fuse directory endpoints based both on an ftp connection and then do regular copy commands or something more complex.

Assume you are using a distro based on apt (but is the same with yum, and so on..)

Install the curlftpfs package:

apt-get install curlftpfs

Create a directory linked to the ftp:

mkdir /mnt/ftp1

Do the same for the second one:

mkdir /mnt/ftp2

Connect to the host1 and host2:

curlftpfs user1:pass1@host1 /mnt/ftp1
curlftpfs user2:pass2@host2 /mnt/ftp2

Do a simple copy command

cp -R /mnt/ftp1/somedir /mnt/ftp2

When you have finished you can simply unmount the 2 mounts

umount /mnt/ftp1
umount /mnt/ftp2

This solution use plain ftp, if you want to take extra advantage of encryption you can use ftps with equivalent commands or in case of shell ftp sftp, but you said that one machine is windows so unless using something like cygwin I guess sftp is out of question.

  • 1
    Hi, your solution look like an extra effort for my excising solution, but still thanks for the suggestion, I will check it and update!
    – EddieM
    Mar 24, 2016 at 15:57
  • Man, discover fuse and you will find your nirvana :P Is super useful to create such kind of complex setups.. Mar 24, 2016 at 15:58
  • @EddieM excising... you mean existing?
    – NH.
    Dec 31, 2016 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.