cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1738
Views
5
Helpful
4
Replies

EEM: Search Index from file flash

Mario C. G.
Level 1
Level 1

Hi Team,

I trying make an EEM applet for delete one file from my flash if this is reach some limit.

I search the OID and this work fine, but if I reload my router this OID change (the last index of the file).

For this reason, I like first search this OID for this File in the flash and after this delete my file.

Regards

1 Accepted Solution

Accepted Solutions

Given this output:

Directory of flash0:/c1900-universalk9-mz.SPA.156-2.T.bin

  250  -rw-    81042792  Apr 20 2016 16:34:56 -04:00  c1900-universalk9-mz.SPA.156-2.T.bin

I would use:

regexp " +[0-9]+ +-rw- +([0-9]+).*c1900-universalk9-mz.SPA.156-2.T.bin" $_cli_result match size

And the $size variable would give me the size for the c1900-universalk9-mz.SPA.156-2.T.bin file.

View solution in original post

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

CLI would work better for this since you can parse the output of "dir" and simply delete the file you want by name. 

Hi Joe,

I am trying many times to get tu size file from this output but I can't.

You know how I can get the file size from dir flash command?

I need check the file size before delete this

Thank you for your time and help, have a nice day!!!!!

Given this output:

Directory of flash0:/c1900-universalk9-mz.SPA.156-2.T.bin

  250  -rw-    81042792  Apr 20 2016 16:34:56 -04:00  c1900-universalk9-mz.SPA.156-2.T.bin

I would use:

regexp " +[0-9]+ +-rw- +([0-9]+).*c1900-universalk9-mz.SPA.156-2.T.bin" $_cli_result match size

And the $size variable would give me the size for the c1900-universalk9-mz.SPA.156-2.T.bin file.

Hi Joe,

You are a Master. Your answer resolved my issue

GW-LAB-3900#dir flash:SRST.txt
Directory of flash0:/SRST.txt
  461  -rw-         192   Jun 8 2017 14:16:42 -05:00  SRST.txt
261222400 bytes total (149004288 bytes free)
GW-LAB-3900#event manager run TEST
192

Thanks a lot for:

Your help

Monitor and respond.

Your Time

Regards