From: Charlie on
I'm trying to split a text string ... Apart from it not working quite right
yet! I'm sure I've over complicated it.

Base Data "Path":

\\SERVER\X$\data\Team Name\Personal Data\JOE BLOGGS\mail\

I'm trying to split into High Level Directory (HLD) / Team/User Directory
(TUD) / Team/User Sub-Directory





HLD: data\Team Name\ <> TUD Personal Data <> SubDir: \JOE BLOGGS\mail\ --OK
HLD: #VALUE! <> N/A <> SubDir: N/A --WRONG
HLD: RECYCLER\ <> N/A <> SubDir: N/A --OK
HLD: $Extend\ <> N/A <> SubDir: N/A --WRONG
HLD: $Extend\ <> N/A <> SubDir: t –WRONG

It works with most of the data, but not when I get to root files!

Any suggestions would be welcome :o)

From: p45cal on

what makes:
HLD: RECYCLER\ <> N/A <> SubDir: N/A
HLD: $Extend\ <> N/A <> SubDir: N/A

Please add what you'd want to see as results for the three 'wrong' ones
and give some guide as to what rules you apply to decide what's what.


p45cal's Profile:
View this thread:

From: Charlie on
You're quite right the wrong ones are:

HLD: #VALUE! <> N/A <> SubDir: N/A –WRONG

What I was trying to see was:
HLD: N/A <> N/A <> SubDir: N/A


HLD: $Extend\ <> N/A <> SubDir: t –WRONG

Aiming for:
HLD: $Extend\Test <> N/A <> SubDir: N/A

i.e. I'm trying to do ...
from the source string, say ...
\\SERVER\X$\data\Team Name\Personal Data\UserName\mail\
I'm trying to ignore the server and drive,

Take the next 2 directories as HLD (High Level Directory). If there's only
one directory after the server/drive use that as HLD

The next 1 as Directory

Remaining directories as sub-directories

HLD = data\Team Name\
Directory = Personal Data
Sub-Directories = \UserName\mail\

From: Charlie on
Thanks. That worked a treat ... Think I'll have to get into functions as
they're easier to read :o)