Change directory level (effectively DOS cd ..)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
I have source data in a directory structured like C:\2020-21\Source Data\BHE
Using the Directory Tool I have the path stored in the directory variable [Directory]
I want to store the output in C:\2020-21 (up 2 levels)
Is there anyway to perform something similar to the DOS command "cd ..\.." to get to C:\2020-21?
I am currently using the Substring function to hard-code it, but there has to be a more elegant solution. I've looked at the 'Run Command' tool, but even that seems like overkill. Any suggestions would be appreciated.
Thanks,
--sue
Solved! Go to Solution.
- Labels:
- Developer Tools
- Dynamic Processing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @YeahMan
Sounds like you may want to use a relative path in your output:
https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-To-Use-Relative-Paths/ta-p/1160
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@YeahMan Looking for something like this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @binuacs . That works, but dang it's ugly 😁. I'm going to see if I can construct a regex solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @binuacs for the regex. It got me close! I ended up using the following:
REGEX_Replace([Directory],'[\s*[a-z A-Z 0-9]+\\\s*[a-z A-Z 0-9]+\\]*$', '')
as it gives me a little more flexibility in the directory names.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @Luke_C for the suggestion. I didn't end up using it for this purpose, but I used it for something else.
