deleting a directory in flash:

Unanswered Question
Apr 21st, 2008
User Badges:

Started to upgrade IOS image on new switch, upgrage was interrupted. Now when I issue the command to upgrade image I get error message "unable to create temp dir flash:update". There is an Update directory already there and I am assuming I need to delete it. Trying to delete it I get message "error deleting flash:update (it is a directory)


Found it, able to delete using /recursive


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4 (9 ratings)
Loading.
Craig Norborg Mon, 04/21/2008 - 05:44
User Badges:
  • Bronze, 100 points or more

Yes, either the /recursive or using "rmdir" instead of "delete" will do it.

glen.grant Mon, 04/21/2008 - 06:03
User Badges:
  • Purple, 4500 points or more

Use "delete /force /recursive flash: "

Toivo Tue, 05/19/2009 - 07:22
User Badges:

I'm running into the same issue with a number of my switches, but none of the fixes above work.


rmdir:

uta-146-gsw3#rmdir flash:update

Remove directory filename [update]?

Delete flash:update? [confirm]

%Error Removing dir flash:update (Device or resource busy)


delete /recursive:

uta-146-gsw3#delete /recursive flash:update

Delete filename [update]?

Examine files in directory flash:update? [confirm]

Delete flash:update? [confirm]

%Error Removing dir flash:update (Device or resource busy)


delete /recursive /force:

uta-146-gsw3#delete /recursive /force flash:update


Doesn't show an error message, but when I look at what's on the flash, the directory is still there:

uta-146-gsw3#dir flash:

Directory of flash:/


2 -rwx 796 May 15 2009 15:49:49 -04:00 vlan.dat

3 -rwx 2072 May 15 2009 15:52:15 -04:00 multiple-fs

4 drwx 192 Feb 28 1993 19:25:28 -05:00 c2960-lanbasek9-mz.122-44.SE2

7 -rwx 26205 May 15 2009 15:52:15 -04:00 config.text

8 drwx 0 May 19 2009 10:29:28 -04:00 update

9 -rwx 3828 May 15 2009 15:52:15 -04:00 private-config.text


32514048 bytes total (22191104 bytes free)


glen.grant Tue, 05/19/2009 - 17:21
User Badges:
  • Purple, 4500 points or more

Glad to see you fixed it.

Toivo Wed, 05/20/2009 - 09:13
User Badges:

It appears a lot like bug CSCsc41813, but occurs with a 2960 12.2(35)SE5. Waiting for 24 hours or so seems to clear the undeletable directory.

handsy Wed, 05/20/2009 - 13:01
User Badges:

Can I ask that you retry your command adding a '/' in place as follows:


rmdir flash:/update


Let us know if that sorts your problem out?



EDIT: aaah, see you fixed it anyway (you edited your 1st post). Well done :)

Toivo Wed, 05/20/2009 - 14:29
User Badges:

Nope, doesn't work either:


uta-146-gsw3#rmdir flash:/update

Remove directory filename [update]?

Delete flash:/update? [confirm]

%Error Removing dir flash:/update (Device or resource busy)


uta-146-gsw3#rmdir flash:/update/

Remove directory filename [/update/]?

Delete flash:/update/? [confirm]

%Error Removing dir flash:/update/ (Device or resource busy)


I'm reloading the switch tonight and trying again tomorrow.

Leo Laohoo Wed, 05/20/2009 - 15:33
User Badges:
  • Super Gold, 25000 points or more
  • Hall of Fame,

    The Hall of Fame designation is a lifetime achievement award based on significant overall achievements in the community. 

  • Cisco Designated VIP,

    2017 LAN, Wireless

Try format flash:


To save the VLAN database, do the following:



vlan datatbase

exit


To save your config, just do write mem.


Don't forget to copy the IOS back to the appliance.


Hope this helps.

Greg Matthews Tue, 05/04/2010 - 18:46
User Badges:

Having the same problem but on a WS-CBS3020-HPQ.


Originally started with an attempted IOS upgrade:

#archive download-sw /overwrite tftp://10.xx.xx.xx/cbs30x0-ipbasek9-tar.122-50.SE1.tar flash: ?
 

#archive download-sw /overwrite tftp://10.xx.xx.xx/cbs30x0-ipbasek9-tar.122-50.SE1.tar flash:
Loading cbs30x0-ipbasek9-tar.122-50.SE1.tar from 10.25.167.176 (via Vlan32): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 12144640 bytes]

Loading cbs30x0-ipbasek9-tar.122-50.SE1.tar from 10.25.167.176 (via Vlan32): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Could not buffer tarfile...using multiple downloads
examining image...
extracting info (110 bytes)
extracting cbs30x0-ipbasek9-mz.122-50.SE1/info (389 bytes)
extracting info (110 bytes)

Stacking Version Number: 1.41

System Type:             0x00000000
  Ios Image File Size:   0x0094C200
  Total Image File Size: 0x00B95200
  Minimum Dram required: 0x08000000
  Image Suffix:          ipbasek9-122-50.SE1
  Image Directory:       cbs30x0-ipbasek9-mz.122-50.SE1
  Image Name:            cbs30x0-ipbasek9-mz.122-50.SE1.bin
  Image Feature:         IP|LAYER_3|SSH|3DES|MIN_DRAM_MEG=128

examining image...
%Error, "flash:" is a directory.
%Error, "flash:" is a directory.
%Error opening flash:update/info (No such file or directory)
ERROR: Malformed `info' file.
ERROR: Image is not a valid IOS image archive.

Unable to delete temp dir "flash:update"
#dir
#dir flash
#dir flash:
Directory of flash:/

    2  -rwx        3136  Mar 15 2010 13:59:52 +11:00  vlan.dat
    3  -rwx        8853   May 5 2010 11:10:38 +10:00  config.text
    4  -rwx        8746   May 5 2010 11:10:38 +10:00  private-config.text
    5  drwx           0   May 5 2010 11:13:31 +10:00  update
    6  -rwx        2072   May 5 2010 11:10:38 +10:00  multiple-fs
  473  drwx         192  Feb 13 2008 06:33:40 +11:00  cbs30x0-lanbasek9-mz.122-37.SE1

32514048 bytes total (24393216 bytes free)
#


Tried all the recommendations:

#rm
#rmdir fl
#rmdir flash:update
Remove directory filename [/update/update]?
Delete flash:/update/update? [confirm]
%Error Removing dir flash:/update/update (No such file or directory)
#
#rm
#rmdir fl
#rmdir flash:/update
Remove directory filename [update]?
Delete flash:/update? [confirm]
%Error Removing dir flash:/update (Device or resource busy)
#
#
#
#del
#delete /r
#delete /recursive /f
#delete /recursive /force fl
#delete /recursive /force flash:update
#delete /recursive /force flash:update
#
#
#dir
#dir flash
#dir flash:
Directory of flash:/

    2  -rwx        3136  Mar 15 2010 13:59:52 +11:00  vlan.dat
    3  -rwx        8853   May 5 2010 11:10:38 +10:00  config.text
    4  -rwx        8746   May 5 2010 11:10:38 +10:00  private-config.text
    5  drwx           0   May 5 2010 11:13:31 +10:00  update
    6  -rwx        2072   May 5 2010 11:10:38 +10:00  multiple-fs
  473  drwx           0   May 5 2010 11:14:32 +10:00  cbs30x0-lanbasek9-mz.122-37.SE1

32514048 bytes total (32488448 bytes free)
#
#
#del
#delete /r
#delete /recursive /f
#delete /recursive /force fl
#delete /recursive /force flash:/update
#
#dir
#dir flas
#dir flash:
Directory of flash:/

    2  -rwx        3136  Mar 15 2010 13:59:52 +11:00  vlan.dat
    3  -rwx        8853   May 5 2010 11:10:38 +10:00  config.text
    4  -rwx        8746   May 5 2010 11:10:38 +10:00  private-config.text
    5  drwx           0   May 5 2010 11:13:31 +10:00  update
    6  -rwx        2072   May 5 2010 11:10:38 +10:00  multiple-fs
  473  drwx           0   May 5 2010 11:14:32 +10:00  cbs30x0-lanbasek9-mz.122-37.SE1

32514048 bytes total (32488448 bytes free)
#

Leo Laohoo Wed, 05/05/2010 - 02:02
User Badges:
  • Super Gold, 25000 points or more
  • Hall of Fame,

    The Hall of Fame designation is a lifetime achievement award based on significant overall achievements in the community. 

  • Cisco Designated VIP,

    2017 LAN, Wireless

delete /f /r flash:update


Don't forget to rate our post.  Thanks.

vvasisth Wed, 05/05/2010 - 01:59
User Badges:
  • Silver, 250 points or more

delete /force /recursive flash:

Ryanwessels_2 Sat, 04/16/2011 - 10:00
User Badges:

HI,


Using delete /f /r flash:update does not remove the flash:update file. Can anyone Guarantee that if i reload the switch that the switch will come back up as per normal without any issues, then i can try the upgrade again. I only have remote access to the relevant switch. Below is the output from the switch:


NZWLGUNI16SW02#delete /f /r flash:update

NZWLGUNI16SW02#

NZWLGUNI16SW02#sh flash:

Directory of flash:/

    2  drwx         512   Mar 1 1993 13:02:11 +13:00  c2960-lanbasek9-mz.122-44.SE6
  544  -rwx       19567  Apr 16 2011 18:30:51 +12:00  config.text
  545  -rwx         616   Mar 1 1993 13:00:37 +13:00  vlan.dat
  546  -rwx        1918  Apr 16 2011 18:30:51 +12:00  private-config.text
  547  drwx         512  Apr 16 2011 18:50:50 +12:00  update
  548  -rwx        2072  Apr 16 2011 18:30:51 +12:00  multiple-fs

27998208 bytes total (17224704 bytes free)
NZWLGUNI16SW02#

NZWLGUNI16SW02#sh boot
BOOT path-list      : flash:/c2960-lanbasek9-mz.122-44.SE6/c2960-lanbasek9-mz.122-44.SE6.bin
Config file         : flash:/config.text
Private Config file : flash:/private-config.text
Enable Break        : no
Manual Boot         : no
HELPER path-list    :
Auto upgrade        : yes
Auto upgrade path   :
NVRAM/Config file
      buffer size:   65536
Timeout for Config
          Download:    0 seconds
Config Download
       via DHCP:       disabled (next boot: disabled)
NZWLGUNI16SW02#


Thanks

Leo Laohoo Sat, 04/16/2011 - 16:07
User Badges:
  • Super Gold, 25000 points or more
  • Hall of Fame,

    The Hall of Fame designation is a lifetime achievement award based on significant overall achievements in the community. 

  • Cisco Designated VIP,

    2017 LAN, Wireless

BOOT path-list      : flash:/c2960-lanbasek9-mz.122-44.SE6/c2960-lanbasek9-mz.122-44.SE6.bin

Ryan,


Firstly, don't worry about this.  The new switches are alot smarter than the older 2900/3500XL series.  If the file in the boot string is not found the switch will search for the first IOS file it can find.

Can anyone Guarantee that if i reload the switch that the switch will come back up as per normal without any issues,

Sure.  I can "guarantee" that.  But if I'm wrong what can you do?  I don't work for Cisco and I'm here posting on my free time.  Common rule when dealing with anything:  If you don't know what you're doing then don't do it.


NZWLGUNI16SW02#delete /f /r flash:update

I can only think of only one reason why you can't delete the "update" sub-directory:  You are probably using the "archive download-sw" command and the process is still on-going.


In order for your switch to boot up properly, you'll need to make sure that the subdirectory of "c2960-lanbasek9-mz.122-44.SE6" contains a valid IOS BIN file.

michal1983 Tue, 02/12/2013 - 04:35
User Badges:

First i need to say Hello to all because i am new here. so Hello;]


leolaohoo you are right he probably using "archive download-sw" command. Same thing happens to me. When i was pissed enough i finally use "erase flash" command and next xmodem to download new OS and it working great.

But it takes ages to download it. After start new OS no more problems with "archive download-sw" command again.



Sorry for my english.

hhuevel@gmail.com Mon, 03/27/2017 - 23:08
User Badges:

Common rule when dealing with anything:  If you don't know what you're doing then don't do it.

If you don't know what you're doing Then do it = learning :)

Ill did try many commands some work some  don't .

PalladiumOne Wed, 08/14/2013 - 00:58
User Badges:

Hello Everyone,


I'm very new to the Cisco world, I just recently got a switch and have been staying up for days at a time figuring it out.

Then found this discussion, learned some things and solved my issue. I hope this helps someone! Anyway, I was having a similar issue, but with the old IOS file itself.  The following is a visual what I was experiencing while attempting to delete my old file-Problem Areas In Bold Letters- because my new file is at least 5 MB:


usatl01cisco01#dir flash:

Directory of flash:/


    2  -rwx     3721984  Jan 01 1970 02:19:06 +00:00  c2950-i6k2l2q4-mz.121-22.E

A13.bin

    3  -rwx         990  Mar 01 1993 00:24:53 +00:00  config.text

    4  -rwx          24  Mar 01 1993 00:24:53 +00:00  private-config.text

    5  -rwx        1031  Mar 03 1993 01:56:24 +00:00  config.old

    6  -rwx        3018  Apr 07 1993 22:39:57 +00:00  statrtup-config

    7  -rwx         108  Mar 01 1993 00:01:35 +00:00  info

    8  drwx           0  Mar 01 1993 10:29:26 +00:00  html

   19  -rwx         108  Mar 01 1993 00:03:43 +00:00  info.ver

   20  -rwx         269  Jan 01 1970 00:04:34 +00:00  env_vars

   21  -rwx         676  Mar 01 1993 01:40:02 +00:00  vlan.dat.renamed

   22  -rwx        3060  Mar 16 1993 02:32:09 +00:00  config

   24  -rwx        1596  Mar 01 1993 02:18:29 +00:00  config.text.renamed

   25  -rwx          24  Mar 01 1993 02:18:29 +00:00  private-config.text.rename

d


7741440 bytes total (4003328 bytes free)


Switch#delete flash:c2950-i6k2l2q4-mz.121-22.A13.bin

Delete filename [c2950-i6k2l2q4-mz.121-22.A13.bin]?

Delete flash:c2950-i6k2l2q4-mz.121-22.A13.bin? [confirm]

%Error deleting flash:c2950-i6k2l2q4-mz.121-22.A13.bin (No such file or directory)


We know it is there cause we can see it clear as day. So I came here and with in minutes I had the following resaults:


Switch#delete /recursive flash:c2950-i6k2l2q4-mz.121-22.EA13.bin

Delete filename [c2950-i6k2l2q4-mz.121-22.EA13.bin]?

Delete flash:c2950-i6k2l2q4-mz.121-22.EA13.bin? [confirm]

Switch#


Switch#dir flash:

Directory of flash:/



    3  -rwx         990  Mar 01 1993 00:24:53 +00:00  config.text

    4  -rwx          24  Mar 01 1993 00:24:53 +00:00  private-config.text

    5  -rwx        1031  Mar 03 1993 01:56:24 +00:00  config.old

    6  -rwx        3018  Apr 07 1993 22:39:57 +00:00  statrtup-config

    7  -rwx         108  Mar 01 1993 00:01:35 +00:00  info

    8  drwx           0  Mar 01 1993 10:29:26 +00:00  html

   19  -rwx         108  Mar 01 1993 00:03:43 +00:00  info.ver

   20  -rwx         269  Jan 01 1970 00:04:34 +00:00  env_vars

   21  -rwx         676  Mar 01 1993 01:40:02 +00:00  vlan.dat.renamed

   22  -rwx        3060  Mar 16 1993 02:32:09 +00:00  config

   24  -rwx        1596  Mar 01 1993 02:18:29 +00:00  config.text.renamed

   25  -rwx          24  Mar 01 1993 02:18:29 +00:00  private-config.text.rename

d



7741440 bytes total (7725568 bytes free)

Switch#


And Good Night Batman, it worked! Thanks Again!


Hey, to you folks with the dir issue have you tried to copy your backup file into the dir then try to delete it? Some it appears that our devices are not seeing neither the file nor its directory. Is it possible that the dadt could be defragmented?


Best Regards,


W


Tcharles

glen.grant Wed, 08/14/2013 - 05:13
User Badges:
  • Purple, 4500 points or more

  Your first attempt you used the wrong name , take a close look you have "

Switch#delete flash:c2950-i6k2l2q4-mz.121-22.A13.bin ,   you are missing an "E" before the A13  so it rejected the imagename and failed. If the name would have been correct your first attempt would have worked.

PalladiumOne Wed, 08/14/2013 - 12:58
User Badges:

Hey Glenn thanks,


You are probably right! However, that was my last failed attempt. I will have to review my log to see what I actually typed in on my long list of failed attempts.  Most likely I typoed every time cause I was half cocked and sideways.  But, I'm glad I was cause i would have never entered this blog.  Thanks again and I look forward to seeing you here!

princekennedy Wed, 10/16/2013 - 09:18
User Badges:

Is very easy to fix this problem just do a show flash output you will see a filename update delete that with the below command

delete /r /f flash:update

and you will be all set to go depending on which platform of switch you are using. In my case i was upgrading a 3750 switch in a stack and one of our engineers accidentally pull of the power from the main outlet.


switch#archive download-sw usbflash0:(name of ios) i hope this helps thank you.

princekennedy Wed, 10/16/2013 - 09:19
User Badges:

Is very easy to fix this problem just do a show flash output you will see a filename update delete that with the below command

delete /r /f flash:update

and  you will be all set to go depending on which platform of switch you are  using. In my case i was upgrading a 3750 switch in a stack and one of  our engineers accidentally pull of the power from the main outlet.


switch#archive download-sw usbflash0:(name of ios) i hope this helps thank you.

princekennedy Wed, 10/16/2013 - 09:19
User Badges:

Is very easy to fix this problem just do a show flash output you will see a filename update delete that with the below command

delete /r /f flash:update

and  you will be all set to go depending on which platform of switch you are  using. In my case i was upgrading a 3750 switch in a stack and one of  our engineers accidentally pull of the power from the main outlet.


switch#archive download-sw usbflash0:(name of ios) i hope this helps thank you.

princekennedy Wed, 10/16/2013 - 09:30
User Badges:

Is very easy to fix this problem just do a show flash output you will see a filename update delete that with the below command

delete /r /f flash:update

and  you will be all set to go depending on which platform of switch you are  using. In my case i was upgrading a 3750 switch in a stack and one of  our engineers accidentally pull of the power from the main outlet.


switch#archive download-sw usbflash0:(name of ios) i hope this helps thank you.

pathiksohel Wed, 12/16/2015 - 20:36
User Badges:

#format flash: will delete every thing from the flash. 

Claudio Quiroz ... Fri, 03/18/2016 - 10:53
User Badges:

I just wrote the command, but when I saw the flash memory again, some files are shown like deleted and other aren´t and I don´t know why.

2651XM#dir flash:

Directory of flash:/

1 -rw- 27092404 <no date> c2600-ipvoicek9-mz.124-15. T14.bin
17 -rw- 24985 <no date> bacdprompts/app-b-acd-2.1. 2.2.tcl
18 -rw- 35485 <no date> bacdprompts/app-b-acd-aa-2 .1.2.2.tcl

28 -rw- 131470 <no date> Desktops/320x212x12/Campus Night.png
29 -rw- 80565 <no date> Desktops/320x212x12/CiscoF ountain.png

39 -rw- 4802 <no date> gui/admin_user.html
40 -rw- 657587 <no date> gui/admin_user.js

33030140 bytes total (0 bytes free)



2651XM#delete /force/recursive flash:bacdprompts
2651XM#delete /force /recursive flash:gui
2651XM#delete /force /recursive flash:Desktops


2651XM#show flash:

System flash directory:
File Length Name/status
1 27092404 c2600-ipvoicek9-mz.124-15.T14.bin
2 18836 bacdprompts/app-b-acd-2.1.2.2-ReadMe.txt [deleted]
3 24985 bacdprompts/app-b-acd-2.1.2.2.tcl [deleted]

14 131470 Desktops/320x212x12/CampusNight.png [deleted]
15 79872 Desktops/320x212x12/CiscoFountain.png [deleted]
16 18836 bacdprompts/app-b-acd-2.1.2.2-ReadMe.txt [deleted]
17 24985 bacdprompts/app-b-acd-2.1.2.2.tcl
18 35485 bacdprompts/app-b-acd-aa-2.1.2.2.tcl
19 75650 bacdprompts/en_bacd_allagentsbusy.au
20 83291 bacdprompts/en_bacd_disconnect.au
21 63055 bacdprompts/en_bacd_enter_dest.au
22 37952 bacdprompts/en_bacd_invalidoption.au
23 496521 bacdprompts/en_bacd_music_on_hold.au
24 123446 bacdprompts/en_bacd_options_menu.au
25 42978 bacdprompts/en_bacd_welcome.au
26 34794 bacdprompts/en_bacd_xferto_operator.au
27 20954 CME41-full-readme.txt [deleted]
28 131470 Desktops/320x212x12/CampusNight.png
29 80565 Desktops/320x212x12/CiscoFountain.png
30 628 Desktops/320x212x12/List.xml
31 109076 Desktops/320x212x12/MorroRock.png
32 108087 Desktops/320x212x12/NantucketFlowers.png
33 10820 Desktops/320x212x12/TN-CampusNight.png
34 9657 Desktops/320x212x12/TN-CiscoFountain.png
35 7953 Desktops/320x212x12/TN-Fountain.png
36 7274 Desktops/320x212x12/TN-MorroRock.png
37 9933 Desktops/320x212x12/TN-NantucketFlowers.png
38 138278 Desktops/320x212x12/Fountain.png
39 4802 gui/admin_user.html
40 657587 gui/admin_user.js
41 1602 gui/CiscoLogo.gif
42 716 gui/CME_GUI_README.TXT
43 953 gui/Delete.gif
44 16344 gui/dom.js
45 864 gui/downarrow.gif
46 6146 gui/ephone_admin.html
47 4658 gui/logohome.gif
48 3724 gui/normal_user.html
49 81443 gui/normal_user.js
50 1347 gui/Plus.gif
51 843 gui/sxiconad.gif
52 174 gui/Tab.gif
53 2431 gui/telephony_service.html
54 870 gui/uparrow.gif
55 9968 gui/xml-test.html
56 3412 gui/xml.template
57 496521 music-on-hold.au [deleted]
58 1698556 phone/7945-7965/apps45.8-3-1-22.sbn [deleted]
[33030140 bytes used, 0 available, 33030140 total]
32768K bytes of processor board System flash (Read/Write)


Actions

This Discussion