|
Post by stan58 on Oct 10, 2018 4:04:58 GMT -5
Help, can anyone show me an example of code that makes a folder in another directory.I guess its the "mkdir" command but what is the syntax to show the path
|
|
|
Post by metro on Oct 10, 2018 4:38:31 GMT -5
some code I use HTH
CSIDL.PERSONAL = 5 'My Documents Folder
myDocuments$ = GetSpecialfolder$(CSIDL.PERSONAL)
if right$(myDocuments$,1)<>"\" then myDocuments$=myDocuments$+"\" end if
'*********************************************** ' HARD CODE PATH ' result = mkdir( "C:\NewTemp") 'if result <> 0 then notice "Temporary directory not created!"
'OR use DefaultDir$+"\"+NewFolder$
'*********************************************** ' or if you want the MyDocuments folder for the current user NewFolder$="NewTemp" result = mkdir( myDocuments$+NewFolder$) if result <> 0 then notice "Temporary directory not created!"
end
Function GetSpecialfolder$(CSIDL) struct IDL,cb As Long, abID As short calldll #shell32, "SHGetSpecialFolderLocation",_ 0 as long, CSIDL as long, IDL as struct, ret as long if ret=0 then Path$ = Space$(512) id=IDL.cb.struct calldll #shell32, "SHGetPathFromIDListA",id as long, Path$ as ptr, ret as long GetSpecialfolder$ = Left$(Path$, InStr(Path$, Chr$(0)) - 1) else GetSpecialfolder$ = "Error" end if End Function 'create a subdirectory named temp in the current directory result = mkdir( "C:\Mytemp") if result <> 0 then notice "Temporary directory not created!"
|
|
|
Post by stan58 on Oct 10, 2018 4:52:37 GMT -5
Thank you Metro,I will give it a try.
|
|
|
Post by stan58 on Oct 10, 2018 5:13:36 GMT -5
Many thanks metro it worked fine.
|
|