Local Structure:
J:\JOB-001_JobName
J:\JOB-002_JobName
Network Structure:
P:\ClinetName_1\JOB-001_JobName
P:\ClinetName_2\JOB-002_JobName
To go from Network to Local I would need to simply remove "ClinetName_1\" and Replace "P:" with "J:" and if the folder did not exist to create it.
This I have tried with regex but can't seem to get the output correct I am using:
Code: Select all
(?:(.*?\\.*?)\\)
Code: Select all
P:\ClinetName_1\
Code: Select all
regexreplace( <curpath> , "(?:(.*?\\.*?)\\)" , "J:\" ) ;
The harder part to this would be going from J: to P: as I would have to search each folder in P: to see if the JOB-001_JobName folder exists. Is looping through the first layer of subfolders doable?
For checking whether or not I am in J: or P: Is there a way to check is a string contains another string?
Code: Select all
// Check to see if the current directory is the pathway
if ( "P:" in <curpath> ) {
// Remove all characters up the the second backslash
$local = regexreplace( <curpath> , "(?:(.*?\\.*?)\\)" , "J:\" ) ;
msg $local ;
}