I'm new here, I would like to ask a question about FTP.
I have an FTP server that contains multiple folders and there are PDF files in them. I wonder if there is a way to access this server through the terminal and delete PDF files through the terminal.
my OS is ubuntu 19.10
I use this command to download the folders
wget -m --user=XXXXX --password=XXXX ftp://XXXXXXX:XXXX/
Now I just need a command to be able to delete the PDF files from the server. š
Best Answer
To delete files/folders from an FTP server, follow these steps:
ftp
and enter to continue.open
and enter to continue.help
to list all available commands that you can run on an ftp server.ls
to list all files and directories.cd <folder_name>
to get into a specified folder.mdelete <filename>
to delete a file or multiple files orrmdir -r <folder_name>
to delete a folder.EDIT:
For some security reasons, you have to type y everytime you want to delete a file. To avoid that, you need to run
ftp -i
in the beginning (instead offtp
). After that, you can delete files directly without typing y for every file (exp:mdelete folder_name/*
will delete all files in folder_name).Also, you can not delete a folder unless it is empty, so you have to delete all its content using
mdelete folder_name/*
, then runrmdir folder_name
to delete a folder.Credits: Mass delete files in FTP server