Jump to content

Get parent folder


Recommended Posts

StringRegExpReplace(@ScriptDir, '\\[^\\]*$', '')

Slightly off topic...I like this solution, but how would I modify it to only show the parent folder name and trim the left side of the path off. For example:

Have this:

$sPath = "C:\test1\test2\test3\test4\test.xml"

Need this:

$sParent = "test4"

Basically just the parent folder name and not the full path to the parent folder.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...