J
Jiz
Hi all, I am trying to create a function to determine the lowest level
directory that I need to backup (robocopy) to correctly move the files
from one volume or server to another. I have created a list of
locations in a text file, and for the following examples, I would like
the function to return only 'E:\GRUPOS'.
E:\GRUPOS\GRUPALES
E:\GRUPOS\GRUPALES\POLÝTICAS Y PROCEDIMIENTOS
E:\GRUPOS\SCANNER
E:\GRUPOS\SE_GENERAL
E:\GRUPOS\SEBA_SAP
E:\GRUPOS\SEBA_SAP\MANUALES SAP
E:\GRUPOS\SEBA_SAP\MANUALES SAP
In fact I want to create a function that given a list it would return
an array of these 'base paths' that if I were to back them up, would
contain all the data directories I need. Something like:
$ret = find_base_paths(@dir_list, \@base_paths);
I have the feeling that this is quite simple, and probably only a
string based solution, but I cannot quite fathom how to do this. Here
is a subset of paths from one of the 800 production servers;
E:\BCKPIVOTAL
E:\FREEHD
E:\GRUPOS\GRUPALES
E:\GRUPOS\GRUPALES\POLÝTICAS Y PROCEDIMIENTOS
E:\GRUPOS\SCANNER
E:\GRUPOS\SE_GENERAL
E:\GRUPOS\SEBA_SAP
E:\GRUPOS\SEBA_SAP\MANUALES SAP
E:\GRUPOS\SEBA_SAP\MANUALES SAP
E:\INTERFACES
E:\PROFILESSA
E:\SAH_PROFS
E:\SETUP
E:\TS_PROFS
E:\USERS\ACOSTCE1SAP
E:\USERS\ADMIN
E:\USERS\ALVIGMA1SAP
E:\USERS\CAMPACE1
E:\USERS\CANOVCH1
E:\USERS\CANOVCH1SAP
E:\USERS\CANTARJU
E:\USERS\CAROSSJO
E:\USERS\CASTRCE1
E:\USERS\CAVIGRO1SAP
E:\USERS\CERESJA1
E:\USERS\CERESJA1SAP
E:\USERS\CUETOGU1SAP
E:\USERS\DIAZSU1
E:\USERS\DIRIEGU1
E:\USERS\ESPINMA1SAP
E:\USERS\FENOGAL1SAP
E:\USERS\FERELFA1
E:\USERS\FERNAMABSAP
E:\USERS\GALEAGU1
E:\USERS\GARCIGU1
E:\USERS\GASTAES1
E:\USERS\GENNANI1
E:\USERS\GIORDOS1SAP
E:\USERS\GIOSUGU1
E:\USERS\HERRMRI1SAP
E:\USERS\JIMENJU4
E:\USERS\KAPELSE1
E:\USERS\KENNYJU1SAP
E:\USERS\KIEKEJU1SAP
E:\USERS\LAMENMA1
E:\USERS\LAUDOPA2
E:\USERS\LAZARJO1SAP
E:\USERS\MANCUED1
E:\USERS\MARTICA2
E:\USERS\MARTICA2SAP
E:\USERS\MAYORPA1SAP
E:\USERS\MORICSE1
E:\USERS\NARDODI1
E:\USERS\PAOLUDA1
E:\USERS\PAOLUDA2SAP
E:\USERS\PARODPI1
E:\USERS\PEREZFR1
E:\USERS\PETTIHE1
E:\USERS\PITTAMA1
E:\USERS\PORTEEZ1
E:\USERS\REYJU1
E:\USERS\RODRIZU1
E:\USERS\ROMERMA1SAP
E:\USERS\RUGERPE1
E:\USERS\SALVAAR1
E:\USERS\SALVAAR1SAP
E:\USERS\SCALASE27
E:\USERS\SESTAES1
E:\USERS\SOUZAMA1SAP
E:\USERS\SUARESE1
E:\USERS\T105826
E:\USERS\T106106
E:\USERS\T134596
E:\USERS\T171773
E:\USERS\T182567
E:\USERS\T196511
E:\USERS\U119833
E:\USERS\U131999
E:\USERS\U132006
E:\USERS\U132013
E:\USERS\U164129
E:\USERS\U169246
E:\USERS\U176246
E:\USERS\U176533
E:\USERS\U176540
E:\USERS\U177758
E:\USERS\U181454
E:\USERS\U189231
E:\USERS\U196518
directory that I need to backup (robocopy) to correctly move the files
from one volume or server to another. I have created a list of
locations in a text file, and for the following examples, I would like
the function to return only 'E:\GRUPOS'.
E:\GRUPOS\GRUPALES
E:\GRUPOS\GRUPALES\POLÝTICAS Y PROCEDIMIENTOS
E:\GRUPOS\SCANNER
E:\GRUPOS\SE_GENERAL
E:\GRUPOS\SEBA_SAP
E:\GRUPOS\SEBA_SAP\MANUALES SAP
E:\GRUPOS\SEBA_SAP\MANUALES SAP
In fact I want to create a function that given a list it would return
an array of these 'base paths' that if I were to back them up, would
contain all the data directories I need. Something like:
$ret = find_base_paths(@dir_list, \@base_paths);
I have the feeling that this is quite simple, and probably only a
string based solution, but I cannot quite fathom how to do this. Here
is a subset of paths from one of the 800 production servers;
E:\BCKPIVOTAL
E:\FREEHD
E:\GRUPOS\GRUPALES
E:\GRUPOS\GRUPALES\POLÝTICAS Y PROCEDIMIENTOS
E:\GRUPOS\SCANNER
E:\GRUPOS\SE_GENERAL
E:\GRUPOS\SEBA_SAP
E:\GRUPOS\SEBA_SAP\MANUALES SAP
E:\GRUPOS\SEBA_SAP\MANUALES SAP
E:\INTERFACES
E:\PROFILESSA
E:\SAH_PROFS
E:\SETUP
E:\TS_PROFS
E:\USERS\ACOSTCE1SAP
E:\USERS\ADMIN
E:\USERS\ALVIGMA1SAP
E:\USERS\CAMPACE1
E:\USERS\CANOVCH1
E:\USERS\CANOVCH1SAP
E:\USERS\CANTARJU
E:\USERS\CAROSSJO
E:\USERS\CASTRCE1
E:\USERS\CAVIGRO1SAP
E:\USERS\CERESJA1
E:\USERS\CERESJA1SAP
E:\USERS\CUETOGU1SAP
E:\USERS\DIAZSU1
E:\USERS\DIRIEGU1
E:\USERS\ESPINMA1SAP
E:\USERS\FENOGAL1SAP
E:\USERS\FERELFA1
E:\USERS\FERNAMABSAP
E:\USERS\GALEAGU1
E:\USERS\GARCIGU1
E:\USERS\GASTAES1
E:\USERS\GENNANI1
E:\USERS\GIORDOS1SAP
E:\USERS\GIOSUGU1
E:\USERS\HERRMRI1SAP
E:\USERS\JIMENJU4
E:\USERS\KAPELSE1
E:\USERS\KENNYJU1SAP
E:\USERS\KIEKEJU1SAP
E:\USERS\LAMENMA1
E:\USERS\LAUDOPA2
E:\USERS\LAZARJO1SAP
E:\USERS\MANCUED1
E:\USERS\MARTICA2
E:\USERS\MARTICA2SAP
E:\USERS\MAYORPA1SAP
E:\USERS\MORICSE1
E:\USERS\NARDODI1
E:\USERS\PAOLUDA1
E:\USERS\PAOLUDA2SAP
E:\USERS\PARODPI1
E:\USERS\PEREZFR1
E:\USERS\PETTIHE1
E:\USERS\PITTAMA1
E:\USERS\PORTEEZ1
E:\USERS\REYJU1
E:\USERS\RODRIZU1
E:\USERS\ROMERMA1SAP
E:\USERS\RUGERPE1
E:\USERS\SALVAAR1
E:\USERS\SALVAAR1SAP
E:\USERS\SCALASE27
E:\USERS\SESTAES1
E:\USERS\SOUZAMA1SAP
E:\USERS\SUARESE1
E:\USERS\T105826
E:\USERS\T106106
E:\USERS\T134596
E:\USERS\T171773
E:\USERS\T182567
E:\USERS\T196511
E:\USERS\U119833
E:\USERS\U131999
E:\USERS\U132006
E:\USERS\U132013
E:\USERS\U164129
E:\USERS\U169246
E:\USERS\U176246
E:\USERS\U176533
E:\USERS\U176540
E:\USERS\U177758
E:\USERS\U181454
E:\USERS\U189231
E:\USERS\U196518