I have two folders with same file names in different location. In some times few files are missing in one folder. How can i get missing file name and location by using python script.
Example: Folder 1 : File1.xlsx;File3.xlsx;File4.xlsx Folder 3 : File1.xlsx;File3.xlsx
Folder 1 is static , means new files are not added and removed in this folder Folder 3 is Dynamic, means new files are added and removed in this folder.
I want to print one message like "File4.xlsx" is missing in the Folder3.
Can you please help me on this scenario. Thanks in advance.
You can create a listing of both directories, convert them into a set and get the difference, something likeb
import os
l1 = os.listdir(folder1)
l2 = os.listdir(folder2)
diff = set(l1). difference(l2)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments