11-22-2023 03:19 PM - edited 11-22-2023 03:20 PM
We have been running several tests on DM jobs to upload batch files through the Harvest. We have a lot of subfolders created that we don't need anymore. Is there any way to delete?
Thanks!
Solved! Go to Solution.
11-23-2023 06:03 AM
Hello,
Here is a snippet of how to do so, all you need to do is add this 'Extensibility' business rule to a Data Management Step or launch it directly and you're set:
Dim folderPath As String = "Applications\<Your Application Name>\Batch" ' You can use si.AppName
Dim mylistofFolders As List(Of XFFolderEx)= BRApi.FileSystem.GetFoldersInFolder(si, FileSystemLocation.FileShare, folderPath, True, True)
For Each folder As XFFolderEx In mylistofFolders
If folder.XFFolder.Name <> "Harvest"
Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
Dim sourceFolderPath As String = FileShareFolderHelper.GetBatchFolderForApp(si, True, configSettings.FileShareRootFolder, si.AppName) & "\" & folder.XFFolder.Name
Directory.Delete(sourceFolderPath, True)
End If
Next folder
11-23-2023 02:09 AM
Hi Diego,
Please refer to this article: How do I delete redundant files from system/file explorer/file share as DELETE Option is Grey ? - On...
Regards,
Manasa
11-23-2023 09:01 AM
Thank you!
11-23-2023 06:03 AM
Hello,
Here is a snippet of how to do so, all you need to do is add this 'Extensibility' business rule to a Data Management Step or launch it directly and you're set:
Dim folderPath As String = "Applications\<Your Application Name>\Batch" ' You can use si.AppName
Dim mylistofFolders As List(Of XFFolderEx)= BRApi.FileSystem.GetFoldersInFolder(si, FileSystemLocation.FileShare, folderPath, True, True)
For Each folder As XFFolderEx In mylistofFolders
If folder.XFFolder.Name <> "Harvest"
Dim configSettings As AppServerConfigSettings = AppServerConfig.GetSettings(si)
Dim sourceFolderPath As String = FileShareFolderHelper.GetBatchFolderForApp(si, True, configSettings.FileShareRootFolder, si.AppName) & "\" & folder.XFFolder.Name
Directory.Delete(sourceFolderPath, True)
End If
Next folder
11-23-2023 09:01 AM
Thank you! very helpful!