18-11-20 11:37 AM
Hi!
I am having problems with file management. Get files.
What is happening to me is that if I run the process manually, it brings me the files in the collection, but when I throw it in the control room, the process ends without doing anything.
From what I was seeing, when it runs by itself, adding an action that counts the number of rows in the collection, it returns 0, that is, it doesn't bring any file and I don't understand why.
I am using BP version 6.7.2
Did someone have this problem?
Thanks a lot!
18-11-20 02:46 PM
18-11-20 02:53 PM
18-11-20 03:02 PM
23-11-20 05:41 PM
24-11-20 01:50 PM
24-11-20 02:51 PM
24-03-21 02:46 PM
Better late than never. 😄
Well I had the same problem and just wanted to share what worked for me.
So if I want get all excel files in folder Y:\My shared folder\Business Folder then the folder path and the pattern should be written as
Folder Path: Y:\My shared folder\Business Folder\
Pattern: "*.xlsx"
Please keep in mind to include the additional back slash "\" at the end. not including it works fine while running from control room and process studio i.e if we keep it like Y:\My shared folder\Business Folder
However, while running through scheduler, "\" needs to be included at the end of the folder path.
Cheers.
09-07-24 06:43 AM
Imports System
Imports System.IO
Public Module Program
Public Sub Main(args As String())
Dim inputFolderPath As String = "D:\BluePrism" ' Change to your input folder path
Dim inputFileStartName As String = "Orders_Sample.xlsx" ' Change to your file prefix
Try
Dim dtCreateTime As DateTime? = Nothing
Dim outLatestFile As String = String.Empty
For Each eachFile As String In Directory.EnumerateFiles(inputFolderPath)
Dim fileInfo As New FileInfo(eachFile)
If fileInfo.Name.StartsWith(inputFileStartName, StringComparison.OrdinalIgnoreCase) Then
Dim fileLastUpdateTime As DateTime = fileInfo.LastWriteTime
If Not dtCreateTime.HasValue OrElse dtCreateTime < fileLastUpdateTime Then
dtCreateTime = fileLastUpdateTime
outLatestFile = fileInfo.Name
End If
End If
Next
If String.IsNullOrEmpty(outLatestFile) Then
Console.WriteLine("No file found matching the specified prefix.")
Else
Console.WriteLine("Latest file: " & outLatestFile)
End If
Catch ex As Exception
Console.WriteLine("An error occurred: " & ex.Message)
End Try
End Sub
End Module