' 10 May 2011 GCC directory remover Copyrighted by J. van Zijl ' Trial Q7Basic for Windows? 7/Vista/XP ALPHA 29-April-2011 (32 bit) ' Purpose, to remove all GCC directory's from the Example directory ' while each GCC directory uses at least 50MB of disk space. ' Warning: ' Let it be clear that this program realy i mean realy will delete all ' files from the GCC directory's and also will remove the GCC directory itself. ' use this at your own risk. ' example fixed on April 26 2012 for BETA 16-April-2012 ' this is the mainwindow scope Outlet SelectDirButton As QPushButton Outlet ExitButton As QPushButton Outlet RemoveButton As QPushButton Outlet Configfilelabel As QLabel Public Dim GCCPath As String Public Dim DirList As List Public Dim TmpList As List Event Init() LoadStartDir() End Event Signal on_SelectDirButton_clicked(Checked As Boolean) Dim IsWritten As Boolean GCCPath = "C:/" GCCPath = OpenFileDialog.GetDirectory("Path to GCC directory 's", GCCPath) IsWritten = WriteString(GCCPath, Application.Path & "\\GCCDirectory.conf") If IsWritten = False Then MsgBox("Write warning ", "Configuration file is not correctly written to disk") End If End Signal Signal on_RemoveButton_clicked(Checked As Boolean) Do While FindDirs() = False Loop MsgBox("All files from and GCC directory's are deleted") End Signal Signal on_ExitButton_clicked(Checked As Boolean) Application.Quit() End Signal Sub LoadStartDir() Dim IsWritten As Boolean GCCPath = Application.Path & "\\GCCDirectory.conf" If FilePressent(GCCPath) = True Then GCCPath = ReadString(GCCPath) Else GCCPath = "C:/" GCCPath = OpenFileDialog.GetDirectory2("Path to GCC directory 's", GCCPath) IsWritten = WriteString(GCCPath, Application.Path & "\\GCCDirectory.conf") If IsWritten = False Then MsgBox("Write warning ", "Configuration file is not correctly written to disk") Exit Sub End If End If Configfilelabel.Text = GCCPath End Sub Function FindDirs() Dim DirName As String Dim FileCount As Int64 Dim Lus As Int64 Dim DirCount As Int64 Dim AllGCCDeleted As Boolean DirList = Dir.List(GCCPath) DoEvents()' added because the application crashed in the release of BETA 16-April-2012 AllGCCDeleted = True Do While FileCount < DirList.Length() ' DirName contains all files generated by Dir.List() DirName = FilePath(DirList.Object(FileCount)) & "/" & FileName(DirList.Object(FileCount)) If InStr(DirName, "/gcc/", 0, False) > 0 Then AllGCCDeleted = False If Delete(DirName) = True Then stdout("File is deleted " & DirName) End If End If If IsDir(DirName) = True Then DirCount = DirCount + 1 TmpList = Dir.List(DirName) For Lus = 0 To TmpList.Length() - 1 DirList.Append(TmpList.Object(Lus)) Next End If FileCount = FileCount + 1 Loop If AllGCCDeleted = False Then Return False Else Return True End If End Function Function FilePressent(MyFile As String) As Boolean If File.Size(MyFile) > 0 Then Return True Else Return False End If End Function