Reputation: 128
I have a unknown amount of characters in a String e.g.
C:/Users/test/Desktop/folder/asd.txt
or
C:/Users/test/Desktop/newFolder/longtextname.txt
And I want to trim the end of this string to get only the path and not the file like this:
C:/Users/test/Desktop/folder/
I already tried with string trim
but it doesn't work..
set s1 "C:/Users/test/Desktop/folder/asd.txt"
set s2 [ string trim $s1 "/*" ]
puts "<$s1> <$s2>"
Has anybody an idea?
Upvotes: 0
Views: 89
Reputation: 13282
Try
file dirname C:/Users/test/Desktop/folder/asd.txt
Documentation: file
Upvotes: 3