<< Back to tutorials

FTP 101 – Part 9: Rename and Remove – Using using FTP cmd

Published {$created} by Carsten Blum


Once your files and folders are on the server, you'll likely want to rename or remove things occasionally.That's where rename and rmdir come in.

To get started, create an FTP account, you can follow the tutorial here create an account with ftpGrid.


rename – Rename files or folders

The rename command lets you change the name of a file or directory on the remote server.


Example:

rename oldfile.txt newfile.txt

This renames oldfile.txt to newfile.txt in the current remote directory.


You can also rename folders:

rename oldfolder archive-2025

Keep in mind:

  • You can't use rename to move files across folders.

  • Not all servers allow renaming open/locked files.


rmdir – Remove a remote directory

Use rmdir to delete a directory on the server.


Example:

rmdir tempfolder

This removes the folder tempfolder – but only if it's empty.


If the folder contains files or subfolders, you'll see an error like:

550 Directory not empty.

You'll need to delete the contents manually first using delete and rmdir step by step.



Related: Deleting files

To delete a file:

delete unwanted.txt

Want to delete many files? Use mdelete:

prompt  
mdelete *.bak


Summary

Task

Command

Rename file or folder

rename old new

Remove empty folder

rmdir foldername

Delete a file

delete filename

Delete multiple files

mdelete *.ext + prompt


ftpGrid supports these operations across FTP, FTPS and SFTP – but for safety, we recommend SFTP, especially when working with automation scripts.



Signup now
© 2025 ftpGrid

ftpGrid ApS
Branebjerg 24
DK-5471
Gamby
Denmark

Looking for an all-in-one time tracking, timesheet, and invoicing solution - visit our sister company Nureti at https://nureti.com.