M
Mugsy_in_Houston
Guest
I'm updating a program I wrote years ago that automatically deletes any files/folders in a specified location that are older than a specified number of days. I've wanted to add support for a "Whitelist" of files/folders to ignore ever since and have only now gotten the itch to finally work on it.
I'd love to be able to select both files AND folders using the same dialog.
I open the Browse Dialog this way:
myOpenFileDlog.InitialDirectory = strCachePath ' Only the contents of this folder may be used.
myOpenFileDlog.Title = "Locate files/folders to protect"
myOpenFileDlog.Filter = "All files (*.*)|*.*"
If myOpenFileDlog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
strFilename = myOpenFileDlog.FileName
' Is strFilename a file or a folder?
If InStrRev(strFilename, "\") = Len(strFilename) Then ' Ends with a "\" = Folder.
Stop ' Additional code to come.
End If
End If
Problem is, you can't select a folder w/o opening it using the standard File Dialog, and I'd rather not have separate buttons for files and folders.
Any ideas? Thx.
Continue reading...
I'd love to be able to select both files AND folders using the same dialog.
I open the Browse Dialog this way:
myOpenFileDlog.InitialDirectory = strCachePath ' Only the contents of this folder may be used.
myOpenFileDlog.Title = "Locate files/folders to protect"
myOpenFileDlog.Filter = "All files (*.*)|*.*"
If myOpenFileDlog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
strFilename = myOpenFileDlog.FileName
' Is strFilename a file or a folder?
If InStrRev(strFilename, "\") = Len(strFilename) Then ' Ends with a "\" = Folder.
Stop ' Additional code to come.
End If
End If
Problem is, you can't select a folder w/o opening it using the standard File Dialog, and I'd rather not have separate buttons for files and folders.
Any ideas? Thx.
Continue reading...