Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
'WARNING - first SHELL lines is serious!
Function PBMain() As Long
Local iReturn As Long, hDlg As Dword
MakeTestFoldersAndFiles
Dialog New Pixels, 0, "PowerBASIC",300,300,200,200, %WS_OverlappedWindow To hDlg
Dialog Show Modal hDlg
'Shell("cmd /C rmdir *.* /S /Q " + Exe.Path$,0) 'remove all folder and file in the installation directory.
iReturn = Shell("cmd /C del /Q " + Exe.Full$,0) '0 means hide. iReturn used so app will not wait for Shelled process to wait
End Function
Sub MakeTestFoldersAndFiles
'Folders
If IsFalse(IsFolder("folderA")) Then MkDir "folderA"
If IsFalse(IsFolder("folderB")) Then MkDir "folderB"
If IsFalse(IsFolder("folderC")) Then MkDir "folderC"
If IsFalse(IsFolder("folderA\folder")) Then MkDir "folderA\folder"
If IsFalse(IsFolder("folderB\folder")) Then MkDir "folderB\folder"
If IsFalse(IsFolder("folderC\folder")) Then MkDir "folderC\folder"
'Files
Open Exe.Path$ + "folderA\fileA1.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderA\fileA2.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderA\fileA3.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderB\fileB1.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderB\fileB2.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderB\fileB3.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderC\fileC1.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderC\fileC2.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderC\fileC3.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderA\folder\fileA.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderB\folder\fileB.txt" For Output As #1 : Close #1
Open Exe.Path$ + "folderC\folder\fileC.txt" For Output As #1 : Close #1
End Sub
'gbs_01384
'Date: 10-17-2014
http://www.garybeene.com/sw/gbsnippets.htm