home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>Příkaz MkDir [Runtime]</title><meta name="filename" content="text/sbasic/common/03020411"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css"> p.P1{ } p.P2{ } span.T1{ font-weight:bold;} </style></head><body> <help:to-be-embedded Eid="mkdir" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:link Id="66444">Příkaz MkDir [Runtime]</help:link></p> <p class="Paragraph">Vytvoří na datovém médiu nový adresář.</p> </help:to-be-embedded> <p class="Paragraph"><span class="T1">Syntaxe</span>:</p> <p class="Paragraph">MkDir Text typu String <help:key-word value="MkDir" tag="kw66444_1" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><span class="T1">Parametr</span>:</p> <p class="Paragraph">Text: Libovolný řetězec určující název adresáře, který má být vytvořen, a cestu k němu. Jako parametr lze také použít <help:link Id="66636" Eid="urllocal" xmlns:help="http://openoffice.org/2000/help">adresu URL</help:link>.</p> <p class="Paragraph">Není-li určena cesta, bude zadaný adresář vytvořen v aktuálním adresáři.</p> <p class="P2">Příklad:</p> <p class="PropText">Sub ExampleFileIO</p> <p class="PropText">' Example for functions of the file organisation</p> <p class="PropText">Const sFile1 as String = "file://c|/autoexec.bat"</p> <p class="PropText">Const sDir1 as String = "file://c|/Temp"</p> <p class="PropText">Const sSubDir1 as String ="Test"</p> <p class="PropText">Const sFile2 as String = "Copied.tmp"</p> <p class="PropText">Const sFile3 as String = "Renamed.tmp"</p> <p class="PropText">Dim sFile as String</p> <p class="PropText">sFile = sDir1 + "/" + sSubDir1</p> <p class="PropText">ChDir( sDir1 )</p> <p class="PropText">If Dir(sSubDir1,16)="" then ' Does the directory exist ?</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>MkDir sSubDir1</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>MsgBox sFile,0,"Create directory"</p> <p class="PropText">End If</p> <p class="PropText"/> <p class="PropText">sFile = sFile + "/" + sFile2</p> <p class="PropText">FileCopy sFile1 , sFile</p> <p class="PropText">MsgBox fSysURL(CurDir()),0,"Current directory"</p> <p class="PropText">MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Creation time"</p> <p class="PropText">MsgBox <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>sFile & Chr(13)& FileLen( sFile ),0,"File length"</p> <p class="PropText">MsgBox <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>sFile & Chr(13)& GetAttr( sFile ),0,"File attributes"</p> <p class="PropText">Name sFile as sDir1 + "/" + sSubDir1 + "/" + sFile3</p> <p class="PropText">' Rename in the same directory</p> <p class="PropText"/> <p class="PropText">sFile = <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>sDir1 + "/" + sSubDir1 + "/" + sFile3</p> <p class="PropText">SetAttr( sFile, 0 ) 'Delete all attributes</p> <p class="PropText">MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"New file attributes"</p> <p class="PropText">Kill sFile</p> <p class="PropText">RmDir sDir1 + "/" + <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>sSubDir1</p> <p class="PropText">end sub</p> <p class="PropText"/> <p class="PropText">' Converts a system path in URL</p> <p class="PropText">Function fSysURL( fSysFp as String ) as String</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Dim iPos <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>As String</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iPos = 1</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iPos = Instr(iPos,fSysFp, getPathSeparator())</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>do while iPos > 0</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>mid( fSysFp, iPos , 1,"/")</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iPos = Instr(iPos+1,fSysFp, getPathSeparator())<text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>loop</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>' the colon with DOS</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iPos = Instr(1,fSysFp,":")<text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>if iPos > 0 then mid( fSysFp, iPos , 1,"|")</p> <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>fSysURL = "file://" & fSysFp</p> <p class="PropText">End Function</p> <p class="PropText"/> <p class="PropText"/> </body></html>