tag:blogger.com,1999:blog-12243715.post111377264706915691..comments2023-05-14T01:08:39.380-07:00Comments on Linux Journal | Linux Tips: Delete all files in directroy except....TravelTouristVideoshttp://www.blogger.com/profile/06397377314569093942noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-12243715.post-2160816243576246282012-08-15T12:42:54.699-07:002012-08-15T12:42:54.699-07:00Learn the find command.Learn the find command.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12243715.post-60671713452982009342010-03-13T08:19:35.877-08:002010-03-13T08:19:35.877-08:00rm !(my_file)
also works, see man bash, pattern ma...rm !(my_file)<br />also works, see man bash, pattern matchingDoruhttps://www.blogger.com/profile/05982062444833518901noreply@blogger.comtag:blogger.com,1999:blog-12243715.post-88715346427607816412010-01-27T08:35:51.734-08:002010-01-27T08:35:51.734-08:00I have classify turned on by default, and there we...I have classify turned on by default, and there were several directories, so I did this:<br /><br />rm -rf $(ls -d --file-type * | grep -v some_file_name)<br /><br />thanks for the hint.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12243715.post-36947626738468878832009-04-05T15:42:00.000-07:002009-04-05T15:42:00.000-07:00In bash, it's more readable and considered better ...In bash, it's more readable and considered better practice to use $() instead of ``. IIRC, sh doesn't have $(), and scripts may need to use `` for compatibility.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12243715.post-76432597009305964662009-02-17T05:39:00.000-08:002009-02-17T05:39:00.000-08:00Probably naive question, but why are you using $()...Probably naive question, but why are you using $() instead of `` ?Anonymousnoreply@blogger.com