FTP - File Exist activity - HELP

File name is: “test 25300 23-08-2023 team 10.xlsx”

Under the File exist activity when i’m adding file name as
“/test *.xlsx” its not finding the files …

can someone help how to get files when file have spaces and number … only one text “TEST” will be comman for all files and rest will change…

I’m trying to check that do my folder have new files which start with name TEST* …

How can i do that?

@Ellen

Directory.getfiles(folderpath,“TEST.xlsx”).count

image
Please follow image because * is not coming in site
you try with above provide

cheers

no its not working… giving error on the code…

@Ellen

place it in

Assign Activity

Countvariable=Directory.getfiles(folderpath,".TEST.xlsx).count

CountVariable is the datatype of Integer

Cheers

Wildcard might not be supported for the ftp. Check this post for a solution to a similar problem: How do I add a wildcard to a string ...? - #10 by ppr

did the same… but still error on acticity

Hi @Ellen

Assign Activity:
Left Side: filePaths (Array of String)
Right Side: Directory.GetFiles(“YourFolderPath”, “TEST *.xlsx”)

For Each Activity:

If Activity (Condition: File.Exists(currentFilePath))
Then:
- Add your processing logic here to work with the existing file.

still not working…

All my files located on Root of FTP connectiong means have no folder…

image

I have a foreach loop on IEnumerable object which will go through all files

in that for each im checking is my file name existing perticular date of each file…

image

This is file name
image

Remember file have both date and time but i only want to check date not time… and that way i’m writing * at the end.

Local panel shows
image

This sitll give me false value on FileExist activity…
why… can someone explain?

@Ellen

Did you check the post that was mentioned?

So basically, you would need to fetch all the file names and then use a Linq statement (or a loop) to see if you can find a match.

I never used LINQ statemenets…

Continuing the discussion from How do I add a wildcard to a string …?:

Could look like this

From Enumerate Objects output - myEOResult

arrFilterResult | FtpObbjectInfo Array =
myEOResult.Where(Function (x) x.Name.toUpper().StartsWith(“TEST”)).ToArray

then you can loop over the arrFilterResult and retrieve Name / Full Name

EDITED: sharing another Filter LINQ sample

(From x In  myEOResult
Where x.Type.Equals(FtpObjectType.File)
Where x.Name.toUpper().StartsWith("TEST")
Select o = x).toArray

we filtered explicitly for files and blocked folders

[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

for prototyping we recommend to play within the immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

it’s difficult to understand.
Is there no easisst way?

Classical for each

in newer UiPath.System.Activites version we can also check:
https://docs.uipath.com/activities/other/latest/workflow/filter-collection

Error :frowning:

Yes, but we can also derive some good hints from the validation message: there is a datatype missmatch

grafik

we are handling FtpObjectInfo objects

Agree I corrected that after I post picture and now its giving error on myFilterResult which is a list of String as datatype

output - Enumerate Objects: DataType: IEnumerable(Of FtpObjectInfo)
myFilterResult - DataType: List(Of FtpObjectInfo)

Do not omit to initalize the myFilterResult before usage with

myFilterResult = new List(Of FtpObjectInfo)()


and

have also tried with this …