How to check if the filename is same on the other filename in the other folder?
Use File Exist activity. It will result in boolean
Hope the following helps you.
Hello @Yoichi ,
What if I have two different zip file and I need to extract it with subfolder? After the extraction I need to check ALL the .cfg file, if the file is existing into another folder (with the same name)?
Here is the sample:
BeforeExample.zip (1.2 KB)
AfterExample.zip (1.3 KB)
Also @Yoichi I need to append line the output.
In this case, we need to extract both zip files, then compare extracted files.
For now, can you try the following workflow?
Sample20221221-1aL.zip (6.5 KB)
This workflow outputs file list of exists in both and only in either one to Output panel.
Hope this helps you.
Your file doesn’t work, if I run the xaml file it stock on the running.
Is there File Dialog behind other window? The above workflow ask which zip file is used, twice.
There is no File Dialog behind other window.
Can you try the following. I removed OpenDialog and set input as BeforeExample.zip and AfterExample.zip
Sample20221221-1aLv2.zip (6.3 KB)
Please check output panel as result.
It works but there’s no output that checks if before are the same to after file = true then if not return false.
I sent some message to you
@Gokul_Jayakumar can you please elaborate your answer?
You can try to get filenames from both directories and compare it as List.
This will give you a list of filename as string format from the Folder 1, you have to assign this to a List(Of string) as “lstFolder1Files” variable in your workflow. Same way do it for Folder2 as well in “lstFolder2Files”.
New System.IO.DirectoryInfo("FolderPath1").GetFiles().Select(Function(file) file.Name).ToList()
lstFolder1Files.Intersect(lstFolder2Files) - this will give your the filenames which are all same in both directories
What activity should I place this code: lstFolder1Files.Intersect(lstFolder2Files) ?
CompareFiles.xaml (5.0 KB)
Try with this workflow
How can I determine if it’s True when all the files are the same and False when there’s a file that are not the same?
Based on the 3rd output list “lstMatchingFiles”, if it is count is greater than one, you can see the matching filename, if it has 0 items then no filename is matching between two folders.
How can I even know or see the output?
You can use ForEach and print the final list “lstMatchingFiles”
there’s no output, please can you do that in the activity?