Microsoft Small Basic

Program Listing: HDF235
' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("Subdirectory created: " + File.CreateDirectory("C:\Temp\TempSubdirectory\"))
' The following line could be harmful and has been automatically commented.
' subdirectories = File.GetDirectories("C:\Temp")

If Array.GetItemCount(subdirectories) = 1 Then
TextWindow.WriteLine("C:\Temp has 1 subdirectory.")
Else
TextWindow.WriteLine("C:\Temp has " + Array.GetItemCount(subdirectories) + " subdirectories.")
EndIf

For i = 1 To Array.GetItemCount(subdirectories)
TextWindow.WriteLine("subdirectories[" + i + "] = " + subdirectories[i])
' The following line could be harmful and has been automatically commented.
' files = File.GetFiles("C:\Temp\" + subdirectories[i])
For j = 1 To Array.GetItemCount(files)
TextWindow.WriteLine(" files[" + i + "] = " + files[i])
EndFor
EndFor

' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("This program's file path is " + File.GetSettingsFilePath())

' The following line could be harmful and has been automatically commented.
' filePath = File.GetTemporaryFilePath()
TextWindow.WriteLine("A temporary file has been created at: " + filePath + ".")
' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("Write to file: " + File.WriteContents(filePath, "Hello, World!"))
' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("Write line to file: " + File.WriteLine(filePath, 15, "Hello Again, World!"))
' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("Insert line in file: " + File.InsertLine(filePath, 20, "Hello Once Again, World!"))
' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("Append to file: " + File.AppendContents(filePath, "Hello For the Last Time, World!"))
' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("File contains: " + File.ReadContents(filePath))
' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("Copy file: " + File.CopyFile(filePath, "C:\Temp\TempSubdirectory\"))

' The following line could be harmful and has been automatically commented.
' If File.LastError = "" Then
Else
' The following line could be harmful and has been automatically commented.
' TextWindow.WriteLine("The last error was: " + File.LastError)
EndIf