[CentOS] delete directories with find and exclude other directories
Chris Beattie
cbeattie at geninfo.comWed Feb 3 19:11:13 UTC 2016
- Previous message: [CentOS] delete directories with find and exclude other directories
- Next message: [CentOS] Kernel Panic post kernel-2.6.32-504.23.4.el6.x86_64
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/3/2016 12:37 PM, Tim Dunphy wrote: > I'm attempting to delete some directories and I want to be able to exclude > a directory called 'logs' from being deleted. Since you can't have a file and a directory named "logs" in the same directory at the same time (that I know of), you could turn on bash's extended globbing. $ shopt -s extglob $ rm -rf !(logs) That will only preserve the top-level entity named logs, though. If there's a "logs" in a subdirectory, it'll get deleted. -- -Chris
- Previous message: [CentOS] delete directories with find and exclude other directories
- Next message: [CentOS] Kernel Panic post kernel-2.6.32-504.23.4.el6.x86_64
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the CentOS mailing list