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
_______________________________________________
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos

Reply via email to