Saturday, June 2, 2018

Comparison two folder and Find distinct file names

Step 1):  Open a Notepad and type the below lines.
dir /s /B /A-D > name.txt
Save this file with .bat as extension. Move the .bat file to which folder you want to get list of file names. Double click the bat file. One file named names.txt will be created, which has list of file names.
Note: i) Only files with dir /B /A-D. /AD meaning only directories, /A-D means not directories.
         ii) /s - apply for sub directory files

Step 2): Names included with path therefore Copy path names in excel and extract only file name via this formula: =MID(A1,FIND("*",SUBSTITUTE(A1,"\","*",LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))))+1,LEN(A1)) 

Step 3): Find file names of both folder and paste into two separate table in access file. And comparison with query to find different file names like: SELECT File_Name from [table_More] where File_Name not in (select File_Name from [table_less])