- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Pick File Question
This is my first time posting here so I apologize if I'm posting in the wrong place. I wondered if anyone can help with the following. Is it possible to get only the file path part from the Pick File function.
If I write(names); I get {"/C:/Users/MT/file1.txt", "/C:/Users/MT/file1.txt"} but I would like just the path C:/Users/MT/ and to be associate that with a variable e.g. file_path = "C:/Users/MT/"
Thanks, Mark
names = Pick File( "Select Data File", "$DESKTOP", {"Text Files|txt;csv", "All Files|*"}, 1, 0, "Data", multiple );
the
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Pick File Question
In the Substr() function, just change the starting location to 2 and subtract one from the count.
path = Substr( names[1], 2, Contains( names[1], "/", -1 ) - 1 );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Pick File Question
You could use the Pick Directory() function instead. Then use Files In Directory() function with the returned path to get the list of files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Pick File Question
I like the solution suggested by @Mark_Bailey best. But here is another possibility that uses character functions to extract the file path.
path = Substr( names[1], 1, Contains( names[1], "/", -1 ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Pick File Question
I'm not sure where this leading / is coming from or how to get rid of it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Pick File Question
In the Substr() function, just change the starting location to 2 and subtract one from the count.
path = Substr( names[1], 2, Contains( names[1], "/", -1 ) - 1 );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Pick File Question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content