Skip to content
WJunction - Webmaster Forum

mass file delete command

Status
Not open for further replies.
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 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
 
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.

About the author

C
Active Member · Joined
1,387
Messages
121
Reactions
63
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom