Is there a Wildcard Function? RRS feed

  • Question

  • Hey guys, I'm making a Personal Assistant type program and was wondering if there's a wildcard function in Small Basic.

    Specifically, I'm looking to delete the contents of my Temp folder.

    I've done some batch programming in the past, and could manage it then.

    I've tried File.DeleteFile("C:\Windows\Temp\*.*")

    But, to no avail.
    • Edited by mrsheltie Thursday, May 14, 2009 9:34 PM
    Thursday, May 14, 2009 12:15 PM


  • If your trying a *.* delete, you can use


    For other delete operations, such as *.jpg, you will need a bit of code -

      populate an array of filenames using File.GetFiles(directoryPath, arrayName)
      scan the array with For index = 1 to Array.GetItemCount(arrayName)

      look for ".jpg" using Text.EndsWith(text, subText)

      if the file needs to be deleted, you can then use File.DeleteFile(Array.GetValue(arrayName, index))

    • Proposed as answer by litdev Thursday, May 14, 2009 6:14 PM
    • Marked as answer by litdev Tuesday, June 2, 2009 10:33 PM
    Thursday, May 14, 2009 4:46 PM