FileShare Harvest Folder view and deletion
- 18 days ago
Sounds like the file structure is too large for the UI to render, and your best bet is to use BRs to examine and delete the unused files.
I would start by trying to get a handle on how many files actually exist in the file share.
Dim sb As New StringBuilder(String.Empty) Dim batch = BRApi.FileSystem.GetFileShareFolder(si, FileShareFolderTypes.Batch, Nothing) Dim directories = Directory.GetDirectories(batch) sb.appendLine(directories.Count().ToString) For Each dir As String In directories sb.appendline("DIRECTORY: " + dir + " Contains " + Directory.GetFiles(dir).Count().ToString + " files") Next brapi.ErrorLog.LogMessage(si, sb.tostring())
This code snippet should let you see how many directories and files exist.
Once you have a list of all of the directories, you can then get a list of all of the files contained in the directory using the Directory.GetFiles command. Then you can loop through the file names and use File.Delete to delete the individual files.
Once the Directory contains no files, you can then use Directory.Delete to remove the old directories.
*BE CAREFUL USING FILE.DELETE and DIRECOTRY.DELETE
You could accidentally remove the Batch or Harvest directory, so make sure you know exactly what will be deleted before executing.