delete everything but one directory

Posted by Zimno on Server Fault See other posts from Server Fault or by Zimno
Published on 2010-05-12T16:21:06Z Indexed on 2010/05/12 16:25 UTC
Read the original article Hit count: 143

Filed under:
|

I've got a /tmp/test directory. In it I've got a mixture of files and directories. One of those directories is /tmp/test/to_be_kept. Now I'd like to know how do I delete all the files and directories apart from /tmp/test/to_be_kept and everything what's in it? Thanks

© Server Fault or respective owner

Related posts about bash

Related posts about command-line