The issue of deleting all other files (clips) outside of the specified file in "Linux" Linux

Source: Internet
Author: User

There is an issue today that you want to delete files other than the specified file (folder). The way it was found on the Internet.

You need to do this in the current folder:

Rm-rf! (keep) #删除keep文件之外的所有文件

Rm-rf! (KEEP1|KEEP2) #删除keep1和keep2文件之外的所有文件

  

There's a big pit under Ubuntu14.04, Keep1 and keep2 with "|" Never leave spaces between them, that is! (Keep1 | keep2). This will delete all the files in the current folder.

It should be written like this (KEEP1|KEEP2).

Specific reasons unknown, and so slowly looking for. Again later to add.

 

The issue of deleting all other files (clips) outside of the specified file in "Linux" Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.