To collect configuration file from Cisco RME
Naming conventions is: 75-20071107230633, which correspond to:
With our script we would be able to collect last "running" configurations from all of the RME controlled devices.
Change $rootpath and destination folder D:\\CONFIGS.
use File::Copy;
$rootpath = "D:\\Program Files\\CSCOpx\\files\\rme\\dcma\\devfiles";
opendir(DIRHANDLE, $rootpath) || die "Cannot opendir: $!";
foreach $name (readdir(DIRHANDLE)) {
if ($name != "." || $name != "..") {
#print "Dir: $name\n";
opendir(DIRHANDLE1, $rootpath."\\".$name);
foreach $name1 (readdir(DIRHANDLE1)) {
# if ($name1 != "." || $name1 != "..") {
#print "-->".$name1."\n";
opendir(DIRHANDLE2, $rootpath."\\".$name."\\".$name1."\\PRIMARY\\RUNNING");
foreach $name2 (readdir(DIRHANDLE2)) {
if ($name2 != "." || $name2 != "..") {
#print "--->".$name2."\n";
opendir(DIRHANDLE3, $rootpath."\\".$name."\\".$name1."\\PRIMARY\\RUNNING\\".$name2);
foreach $name3 (readdir(DIRHANDLE3)) {
if ($name3 != "." || $name3 != "..") {
if( $name3 =~ /cfg/) {
#print "---->";
print $name3;
print "\n";
open(WRFILE, '>D:\\CONFIGS\\'.$name3);
open(ROFILE, $rootpath."\\".$name."\\".$name1."\\PRIMARY\\RUNNING\\".$name2."\\".$name3);
while ($line = ) {
print WRFILE $line;
print "\n";
}
close(ROFILE);
close(WRFILE);
}
}
}
closedir(DIRHANDLE3);
}
}
closedir(DIRHANDLE2);
# }
}
closedir(DIRHANDLE1);
#print "\n";
}
}
closedir(DIRHANDLE);
We have 3 guests and no members online