Rename multiple files using ftp

16,040

Solution 1

In short: You can't. FTP is very basic and does not support mass renaming. You can either write a small script for it, or download some helper software, such as the one here.

Solution 2

Hallo to all,

Even if the question is quite old, I think could be usefull for others to read my suggestion.

I found a great and easy solution combining curlftpfs, "A FTP filesystem based on cURL and FUSE" as they define it, and rename linux and unix multi rename tool.

I tested on linux mint 17 (and I think it should work in other debian based distributions)

  1. install curlftpfs

    sudo apt-get install curlftpfs
  2. create the mount folder

    sudo mkdir /mnt/ftp_remote_root
  3. mount remote ftp on folder

    sudo curlftpfs -o allow_other -o user="USERWITH@CHARACTERTOO:PASSWORDTOACCESSUSER" ftp://my_ftp_server.com /mnt/ftp_remote_root/
  4. jump into desired ftp remote folder

    cd /mnt/ftp_remote_root/path/to/folder
  5. rename as you need files (-v shw new names, -n show interested files, omitt them to rename files)

    sudo rename -v -n 's/match.regexp/replace.regexp/' *.file.to.change

It could took few seconds because it works on network.

I think it is really powerfull and easy to use.

Let me know if you find any problems.

Bye

Lorenzo

Share:
16,040
user1071005
Author by

user1071005

Updated on June 29, 2022

Comments

  • user1071005
    user1071005 almost 2 years

    I have a set of files in my ftp folder. I have access to only ftp mode. I want to rename those files with extension .txt to .done

    Ex:

    1.txt, 2.txt, 3.txt 
    

    to

    1.done, 2.done, 3.done
    

    Only rename command is working in this ftp. I am expecting something like

    rename *.txt *.done 
    

    to rename them all in a single command.