Pick File QuestionThis 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
Re: Pick File QuestionThank you so much Wendy. That worked just great.Re: Pick File QuestionIn 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 );
Re: Pick File QuestionThanks Mark. Much appreciatedRe: Pick File QuestionThanks Wendy, that works except for there's a leading slash so I get "/C:/Users/MT/" instead of "C:/Users/MT/".
I'm not sure where this leading / is coming from or how to get rid of itRe: Pick File QuestionI 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 ) );
Re: Pick File QuestionYou could use the Pick Directory() function instead. Then use Files In Directory() function with the returned path to get the list of files.