How to Check files are present in two different folders

Shaik Bakshu

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.

kofemann

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.

edited at
0

Comments

0 comments
Login to comment

Related

How to check if two filenames exists in different folders

Split files present in different Folders in R

How to keep JSP files in two or more different folders with Springboot?

How to compare Files in two different Folders and perform conditional copying

Python - How to compare files one by one in two different folders

How do I compare two folders recursively and generate a list of files and folders that are different?

find 100 largest numbers from all the files present in different folders

replace a line in files present in different folders shell script

Diff files present in two different directories

How to differentiate files with same name with different extension from two different folders? Python

How to check and delete files that are not same in two different directories in python?

How can I check if same text appears in two different files

How to determine files or folders present within another folder?

In Powerapps; present folders and files in a gallery

How to accurately check folders or files in python

How to print multiple PDF files in different folders?

How to move every 500 files into different folders

How to move files to different folders based on their prefix?

Django: how to upload media files to different folders?

How to push code into two different folders?

How to diff two folders to multiple patch files

Merging fastq files with same barcode in two different folders to another folder

Compare two folders, copy files that are different from one folder to another

How to check two values are present in two columns or not in mysql?

Check if two files are different sizes in Bash

How to merge two databases of mongoDB present in two different computers?

How can I compile different files to different folders, in TypeScript?

How to unzip a zip file and copy the files into different different folders?

How to check two files in R