I have asked this type of a question before but this one IS different. I need to find the root folder of a folder.
For example:
I get is
C:\Program Files (x86)\EdisonFactory\NetOffice
C:\Program Files (x86)\EdisonFactory\NetOffice
C:\Program Files (x86)\EdisonFactory\NetOffice
C:\Program Files (x86)\EdisonFactory\NetOffice
C:\Program Files (x86)\EdisonFactory\NetOffice\Plugins
C:\Program Files (x86)\EdisonFactory\NetOffice\Plugins
C:\Program Files (x86)\EdisonFactory\NetOffice\Plugins
I used this code before:
DsVersions.ASSEMBLY2Row row = dsVersions.ASSEMBLY2.NewASSEMBLY2Row();
row.FOLDER = Path.GetDirectoryName(fileName);
And then i found this code and thought it was the answer:
DsVersions.ASSEMBLY2Row row = dsVersions.ASSEMBLY2.NewASSEMBLY2Row();
DirectoryInfo directoryName = new DirectoryInfo(Path.GetDirectoryName(fileName));
row.FOLDER = directoryName.Name;
After this code i was getting this:
NetOffice
NetOffice
NetOffice
NetOffice
Plugins
Plugins
Plugins
It’s close but again all i need is Plugins. I have tried doing Path and File but it won’t work, I always get an error.
That did the trick.