Before you can remove a directory on Cisco devices the directory must be empty, the below steps will show you how to delete all of the files and folders the directory contains.
Cisco switches often store their IOS in a folder due to them being bundled with HTML files. So this may come in useful when you want to remove your current IOS pre/post an update.
If you are new to Cisco or just want to improve your skills I recommend this course from Udemy at the time of writing for just $20 for lifetime access! I’m also a really big fan of Pluralsight
Steps
- Connect to you device and enter enable mode.
- Display the contents of your flash using the command dir flash: and make a note of the folder you want to delete
- Issue the command delete /recursive /force flash:/c3750-ipbase-mz.122-52.SE where “c3750-ipbase-mz.122-52.SE” is the name of the folder you want to delete.
- Be carful when using the /force switch as you will not get any “are you sure” messages
- This should also remove the directory, if not once the folder is empty you can use the command rm flash:/c3750-ipbase-mz.122-52.SE to remove the now empty folder
Note: If you switch is part of a stack you may need to do the same on the other members flash (flash1:/ flash2:/ flash3:/ etc)
Learning more
If you are new to Cisco or would just like to learn more. Pluralsight has some great courses, I have personally been through their CCNA/CCNP content.
Hi, I about how to clean up the router dir flash model cisco as5300
Good One. Crisp and clear. Thanks for sharing it!
delete /recursive /force flash:/c3750-ipbase-mz.122-52.SE Does not work for me