say the file path is saved as an variable f
puts "$f"
Then outcome is
/home/usr/testfile.txt
I want to remove everything but the name, 'testfile' and save it in a new variable.
The file command is what you want.
set fbasename [file rootname [file tail $f]]
file tail is the last component of the filename. file rootname is everything excepting the extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With