LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-01-2008, 06:07 PM   #1
cwwilson721
Senior Member
 
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649
Blog Entries: 1

Rep: Reputation: 67
Removing multiple files in nested directories...


It should be simple, but how? (Having a bad brain day...lol)

The issue is, my wife's XP machine got overloaded by a virus, and she transferred ALOT of her files to my linux server to save as much as possible. ALL the *.exe files, however, are infected.

I need to delete all the *.exe files in there, but I REALLY don't want to go into each and every directory and
Code:
rm *.exe -v
The '-v' is so I can see what is being removed.

Trying '-r' don't do diddly

Ideas? Script? Or a simple command line switch I'm forgetting about?

The files are all in 'her' directory in the server (NOT THAT STUPID!!). But in the first level are 14 folders, and in each of those is about 7-10 folders, and inside those...(You get the picture)

Last edited by cwwilson721; 04-01-2008 at 06:10 PM.
 
Old 04-01-2008, 06:13 PM   #2
tobyl
Member
 
Registered: Apr 2003
Location: uk
Distribution: slackware current
Posts: 768

Rep: Reputation: 64
how about rm -rf
 
Old 04-01-2008, 06:15 PM   #3
cwwilson721
Senior Member
 
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649

Original Poster
Blog Entries: 1

Rep: Reputation: 67
I need something that will go into the individual folders, and 'rm *.exe'

-rf does not
 
Old 04-01-2008, 06:25 PM   #4
tobyl
Member
 
Registered: Apr 2003
Location: uk
Distribution: slackware current
Posts: 768

Rep: Reputation: 64
ok sorry.


find <path/to/dir> -name "*.exe" |xargs rm
 
Old 04-01-2008, 06:27 PM   #5
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
find -name "*.exe" -exec "rm" "-v" "{}" ";"
 
Old 04-01-2008, 06:29 PM   #6
cwwilson721
Senior Member
 
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649

Original Poster
Blog Entries: 1

Rep: Reputation: 67
Erm...

Would that only find/delete the files inside the folder I'm in? Because my server houses alot of 'good' *.exe files too, and need to keep those
 
Old 04-01-2008, 06:35 PM   #7
tobyl
Member
 
Registered: Apr 2003
Location: uk
Distribution: slackware current
Posts: 768

Rep: Reputation: 64
if you mean my version, yes.
you can always cd to the folder you want to start from and

find . -name "*.exe" |xargs rm

or

find . -name "*.exe" -exec rm {} \;

(note the period)

you can truncate the command to
find . -name "*.exe"

first, you will see what you will get then :-)

Last edited by tobyl; 04-01-2008 at 06:38 PM.
 
Old 04-02-2008, 08:44 AM   #8
cwwilson721
Senior Member
 
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649

Original Poster
Blog Entries: 1

Rep: Reputation: 67
That did it...Than
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
List all files in multiple directories haiders Linux - Newbie 6 05-10-2007 12:05 PM
Change text in multiple files in multiple directories vivo2341 Linux - General 5 11-27-2006 08:16 PM
nested boot directories pugsley Linux - General 5 11-03-2006 06:04 PM
find and copy files into multiple directories avargas22 Linux - Newbie 2 04-01-2004 11:11 AM
Help I need help tarring multiple files in multiple directories VisionZ Linux - Newbie 28 03-25-2004 05:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration