Delete everything in one directory not present in another
A little something slightly outside my bash scripting skills; I want to make a script which deletes everything in one path not present in another path. It must be fully recursive, so it applies to all files / folders / subfolders inside the two paths. For example, if I have:
/foo1/bar1.txt
/foo2/bar1.txt
/foo2/bar2.txt
The command would delete /foo2/bar2.txt because the file isn't also present in /foo1, but keep /foo2/bar1.txt because it is. Does anyone know of a shell script that takes both base folders as arguments and does this?
|