Status
Not open for further replies.

Cheetah

Active Member
1,387
2008
121
0
I am using CentOS 5.3

I am having one folder which contain nearly 1500 files. there are files with txt,gif,rar,jpg extensions. I want to keep rar files and delete all other files.

some pls give me shell command to do that
 
14 comments
Do this:
Code:
$ mkdir allrar ; mv *.rar allrar/; rm *.*

It makes a new directory and moves all .rar files in it. and removes all files in the parent directory
 
i dont want to create new folder. what i look for is a for loop command which searchs for all files except those rar and deletes
 
i dont want to create a new folder like he mentioned " allrar"

the command must just search for all files except rar and delete files. i.e, it wont do any action on rar files like move or copy
 
you can always move the files from allrar folder back.

you don't know the first thing about linux. and i would prefer you go with easy stuff.
 
evilgenius , i know there is such command. i saw it previously some were, but i didn't remember where is was found. if u dont know abt that no problem leave it. i hope someone will find and replay here
 
Status
Not open for further replies.
Back
Top