06-17-2011 09:52 PM
Hello,
I have been working on using EEM and TCL to copy multiple files (starting with file.x) from flash to an FTP server and once they have been copied, i want to delete them from flash. For example:
sho flash | i file.x
211 33 Jun 18 2011 00:36:34 file.x-01
212 33 Jun 18 2011 00:36:38 file.x-02
213 33 Jun 18 2011 00:36:40 file.x-03
214 33 Jun 18 2011 00:36:44 file.x-04
215 33 Jun 18 2011 00:36:48 file.x-05
Searching previous examples of EEM and TCL I found the following TCL structure to copy the file via FTP:
set fileList [glob -directory flash: -nocomplain "file.x*"]
foreach file $fileList {
if [catch {cli_exec $cli1(fd) "copy $file ftp://10.0.0.1/"} _cli_result] {
error $_cli_result $errorInfo
}
}
This work.
However I can't seem to figure out what TCL structure to use to delete them from flash. I tried variations of the above, but they failed.
Can anyone help out?
Thank you for your help in advance!
Solved! Go to Solution.
06-18-2011 09:22 AM
You could simply cli_exec the "delete" command. If you want to use pure Tcl, then add the following in the foreach loop:
if { [catch {file delete -force -- $file} result] } {
error $result $errorInfo
}
06-18-2011 09:22 AM
You could simply cli_exec the "delete" command. If you want to use pure Tcl, then add the following in the foreach loop:
if { [catch {file delete -force -- $file} result] } {
error $result $errorInfo
}
06-18-2011 10:16 AM
That was perfect! Thanks Joe!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide