Results 1 to 2 of 2
Hello
I have directory which has many files and sub directories
similar to what this command will do
mkdir dir{1..100} && touch file{1..100}.txt
I would like to remove all files ...
- 08-16-2011 #1Just Joined!
- Join Date
- Aug 2009
- Location
- Toronto
- Posts
- 31
how to remove all files except few directories
Hello
I have directory which has many files and sub directories
similar to what this command will do
mkdir dir{1..100} && touch file{1..100}.txt
I would like to remove all files and directories excluding file15.txt and dir 79
Thank you
- 08-17-2011 #2Just Joined!
- Join Date
- Aug 2009
- Location
- Toronto
- Posts
- 31
I found the answer for this question
you need to run this command first
then delete all files except the files between bracketsCode:shopt -s extglob
Code:rm !(file1|dir|)


Reply With Quote