Linux - Find - How to Exclude a Directory
Inside the /Tmp I Want to Find Files Older Than 180 Day, but I Also Want to Exclude Some Folders from the Search Like. /Vboxdrv-Module. Symvers. How Can I...
Inside the /tmp I want to find files older than 180 day, but I also want to exclude some folders from the search like ./vboxdrv-Module.symvers. How can I perform the task with find?
1 Answer
This syntax will do what you want:
find -not -newermt 2016-11-10 -not -path "./"
Change with whatever settings you want.
Add as many -not -path you want after each other. Ie.
find -not -newermt 2016-11-10 -not -path "./folder1/*" -not -path "./folder2/*"
Or if you want to do it from another folder:
find /tmp/ -not -newermt 2016-11-10 -not -path "/tmp/folder1/*" -not -path "/tmp/folder2/*"