tcl
पथनाम और फ़ाइलनाम
खोज…
वाक्य - विन्यास
- फ़ाइल dirname फ़ाइलपथ
- फ़ाइल पूंछ फ़ाइलपथ
- फ़ाइल rootname filepath
- फ़ाइल एक्सटेंशन filepath
- path1 path2 में शामिल होने वाली फ़ाइल ...
- फ़ाइल सामान्य पथ
- फ़ाइल का नामकरण पथ
पाथने और फ़ाइल नाम के साथ काम करना
% set mypath /home/tcluser/sources/tcl/myproject/test.tcl
/home/tcluser/sources/tcl/myproject/test.tcl
% set dir [file dirname $mypath]
/home/tcluser/sources/tcl/myproject
% set filename [file tail $mypath]
test.tcl
% set basefilename [file rootname $filename]
test
% set extension [file extension $filename]
.tcl
% set newpath [file join $dir .. .. otherproject]
/home/tcluser/sources/tcl/myproject/../../otherproject
% set newpath [file normalize $newpath]
/home/tcluser/source/otherproject
% set pathdisp [file nativename $newpath] ; # not on windows...
/home/tcluser/source/otherproject
% set pathdisp [file nativename C:$newpath] ; # on windows...
C:\home\tcluser\source\otherproject
% set normpath [file normalize $pathdisp]
C:/home/tcluser/source/otherproject
प्रलेखन: फ़ाइल
Modified text is an extract of the original Stack Overflow Documentation
के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
से संबद्ध नहीं है Stack Overflow