Compare folders and find missing files

P. Echols p.echo926 at gmail.com
Wed Mar 25 07:40:09 UTC 2020


Greetings all,

is there a way to get "find" to return only when a file is NOT found?

I am attempting to list the files on a flash drive (/media/project/) ,
but ONLY, if those files don't exist in a particular folder in my
computer (~/Documents/sub-tree/).  If I cd to the sub-tree folder, I
can run the following:

find /media/project/ -type f -exec basename {} \; | while read fname;
do find -name "$fname"; done

This will list the path and file name for all the files that are
found.  But not the ones that are not found.  Any thoughts how I might
accomplish this?

Thanks
-- PE




More information about the ubuntu-users mailing list