# how to compare two files and get files and get the name differenced file name in ansible

**URL:** <https://forum.ansible.com/t/how-to-compare-two-files-and-get-files-and-get-the-name-differenced-file-name-in-ansible/22588>\
**Category:** Ansible Project\
**Created:** [September 20, 2016, 4:24am UTC](https://forum.ansible.com/t/how-to-compare-two-files-and-get-files-and-get-the-name-differenced-file-name-in-ansible/22588 "2016-09-20T04:24:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chichu\_sam](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@Chichu\_sam](https://forum.ansible.com/u/Chichu_sam)\
**Post date:** [September 20, 2016, 4:24am UTC](https://forum.ansible.com/t/how-to-compare-two-files-and-get-files-and-get-the-name-differenced-file-name-in-ansible/22588/1 "2016-09-20T04:24:28Z")

</div>

HI Fiends,

Please help on this,

Folder1 :Always one file  
cat file2  
SAM:26

Folder2 : two files

cat file2  
RAM:26

cat file 3  
SAM:26

Here first folder folder will have always have one file and it is always standard ,

Second folder might have n number of files

We need to compare the first folder file with second older file with column name

EX. File1 SAM is present in second directory file file 3 it is in sync  
and file 2 is not in sync with file 1

so we need to capture the file in new directory.
