Compare file content and file name

Hello Team,
I have multiple files and each file contains name of file,i want to compare file name and content in file,Please guide

@Mayyur What type of File is it?

@Mayyur

May I know what type of files it is and also along with file name is it contains anything else ?

text file,Like C:\Folder\File1.txt is name and content is File1,so i want to match name and content

Can you please provide one sample file and specify what exactly you are looking for in that file?

File1.txt (7 Bytes) ,I want to check whether file name and content is same or not.

@Mayyur Follow these Steps :

  1. Get all Files from the Folder and Store it in a Array of String variable
  2. Loop through the files using For Each
    Inside For Each
    Use read Text File Activity and Pass the item as Value
    Output Of Read text File, Use it to compare with FileName
1 Like

I have tried the same

ReadFiles_CompareName_UPL.zip (14.2 KB)

@Mayyur Check this :
FileNameFileContent.zip (1.8 KB)

@Mayyur Were you facing problem in Moving files?

@Mayyur I updated your workflow a bit :sweat_smile: Check this as well :
ReadFiles_CompareName.zip (14.7 KB)

2 Likes

It worked,The above also worked fine,Thank you

1 Like

You are trying with item.Equals(Op_Text)
But the item will always have the full file path and you Op_Text will have only the file name. Hence this condition will never work.
You should try Filename contains file text.
I have updated your workflow. Please check if that helps.
ReadFiles_CompareName.zip (14.5 KB)

Hello,
Can you please provide the same WF implemented using reframework

@Mayyur Ok , I will try and Update you, But meanwhile Can you try it as well :sweat_smile: , It can be easy to implement as the Logic is Already present in the Workflow I provided

1 Like

Im trying to do the same, but getting error…

@Mayyur You can provide that Workflow then , it might be easy for me to correct it, Also What error do you get ?

Sure

MoveFile_Reframework.zip (994.9 KB)