Before you can remove a directory on a 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.
Most modern Catalyst switches store their IOS in a folder due them being bundled with HTML files, so this may come in useful when you want to remove your current IOS pre / post an update.
- Connect to you device and enter enable mode
- Display the contents of your flash using the command dir flash: and make a not 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 it
If you switch is part of a stack you may need to do the same on the other members flash (flash1:/ flash2:/ flash3:/ etc)