Find files missing in one directory that are in a second - needs to ignore file extension

Timothy Clotworthy :

I need to find files missing in one directory that are in a second, but I need to ignore file extensions. I need to do this based on file name only, not fill contents. If my file names were identical (including extensions), I could use diff something like:

diff dirA dirB

, however files in directory A have a different extension from those in directory B. I need a way to use something like diff but to ignore the extension differences between the two directories.

Another important point is that each directory may contain hundreds of thousands of files, so I have a need for a relatively efficient process.

Grateful for any ideas.

Kerim :

I hope it helps

I created sample files, look like this sample

/

├── a

│   ├── 1

│   └── 3

└── b

│   ├── 1

│   ├── 2

│   └── 3.txt

$comm -13 <(find a/ -type f -exec bash -c 'basename "${0%.*}"' {} \; | sort) <(find b/ -type f -exec bash -c 'basename "${0%.*}"' {} \; | sort)

output:

2

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=174511&siteId=1