LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-11-2010, 08:25 PM   #1
b-RAM
Member
 
Registered: Apr 2009
Distribution: OpenSuse, Slackware
Posts: 70

Rep: Reputation: 15
find worms that have same name *.exe with the directory ???


Hi all, is there any way to find and delete the worm with extension .exe files but the name is same with the directory.
Ex:
/home/master/
/home/master/master.exe
/g.xls
so that worm name is master.exe with located under directory master, as i know sometimes the sizes of bytes is different.

Need advices please,

Thank's a lot
 
Old 01-11-2010, 08:53 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,682

Rep: Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971
Quote:
Originally Posted by b-RAM View Post
Hi all, is there any way to find and delete the worm with extension .exe files but the name is same with the directory.
Ex:
/home/master/
/home/master/master.exe
/g.xls
so that worm name is master.exe with located under directory master, as i know sometimes the sizes of bytes is different.

Need advices please,

Thank's a lot
Read the man pages for the find and rm commands. For example, to find all .exe files under /home and delete them:
Code:
rm `find /home -name *.exe`
note those are backticks (to the left of the 1 key), not single-quotes.
 
Old 01-11-2010, 09:17 PM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Can't you just ignore them? The .exe extension is meaningless on Linux and UNIX systems. (And, for what it's worth, almost any other modern operating system.)
 
Old 01-11-2010, 09:31 PM   #4
itsbrad212
Member
 
Registered: Nov 2009
Location: Chicago
Distribution: Arch and OpenBSD
Posts: 104

Rep: Reputation: 19
Why would you need to bother with .exe files. Your on linux now

Read it
http://tinyurl.com/yd3sm3w
 
Old 01-11-2010, 10:08 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,682

Rep: Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971
Quote:
Originally Posted by itsbrad212 View Post
Why would you need to bother with .exe files. Your on linux now

Read it
http://tinyurl.com/yd3sm3w
True, but the OP may be trying to eliminate them on a Samba share. The drive may be Linux, but the other systems using it may be Windows.
 
Old 01-11-2010, 11:54 PM   #6
b-RAM
Member
 
Registered: Apr 2009
Distribution: OpenSuse, Slackware
Posts: 70

Original Poster
Rep: Reputation: 15
Thank's for all your replies, i had know about to find -name *.exe with the size usually i know for that worm the problem is the sizes of that worm exe files not same at all, if i just using find the exe files so the other exe files on my home directory will be wiped out by command
so i, and for TB0ne you're right it's in samba share so sometimes it's affect the windows client. ^^

Thank's a lot and need advices please. ^^
 
Old 01-12-2010, 12:17 AM   #7
Elemecca
Member
 
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71

Rep: Reputation: 22
Searching for a file with the same name as its parent directory is rather outside the scope of the shell globs supported by 'find -name'. Find's regular expression support, however, can handle it just fine. Try the command below.
Code:
find /path/to/share -regex '.*/\([^/]+\)/\1.exe' -print0 | xargs -0 rm

Here's the breakdown of that regex:
.*    matches as much as it can of anything
/     matches a literal '/'
\(    opens a capture group
[^/]+ matches one or more characters that are not '/'
\)    closes the capture group
/     matches a literal '/'
\1    matches whatever was matched by the capture group
.exe  matches literal ".exe"
 
1 members found this post helpful.
Old 01-12-2010, 12:28 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You do know about the

-type f

option to find ?
http://linux.die.net/man/1/find
 
Old 01-12-2010, 12:42 AM   #9
b-RAM
Member
 
Registered: Apr 2009
Distribution: OpenSuse, Slackware
Posts: 70

Original Poster
Rep: Reputation: 15
Hi Chrism01, -type f is it for regular file isn't it ? (correct me if i'm wrong ^^), yeah i've used it when try to check if there's still that exe files:
find /home/* -type f -name *.exe -size 42710c -exec rm -f '{}' \;
but sometimes the sizes different so if i don't use -size i'm afraid it will be deleted all files exe on my samba share, and thank's a lot Elemecca for explaination it's very useful enlightment ^^.

Regards,
b-RAM
 
Old 01-12-2010, 03:11 PM   #10
itsbrad212
Member
 
Registered: Nov 2009
Location: Chicago
Distribution: Arch and OpenBSD
Posts: 104

Rep: Reputation: 19
Quote:
Originally Posted by TB0ne View Post
True, but the OP may be trying to eliminate them on a Samba share. The drive may be Linux, but the other systems using it may be Windows.
Ahhh. Never thought of that. How many .exe's is he looking at deleting?
 
Old 01-12-2010, 05:45 PM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
The trick is to come up with a clear set of rules that define the list of files to be eliminated, otherwise you'd have to do it by hand. Don't think I'd use -size, but it depends what you system looks like.
You might need to write a short script, not just a one-liner.
 
Old 01-12-2010, 06:12 PM   #12
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
Quote:
Originally Posted by PTrenholme View Post
Can't you just ignore them? The .exe extension is meaningless on Linux and UNIX systems. (And, for what it's worth, almost any other modern operating system.)
HaHa. I caught that. Nice One.
 
Old 01-12-2010, 06:55 PM   #13
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by itsbrad212 View Post
Why would you need to bother with .exe files. Your on linux now

Read it
http://tinyurl.com/yd3sm3w
Good link, but why do you use tinyurl? It doesn't let me see the real URL in the fist place, and then forces me to wait through an ad on a creepy website before I get to the page.
 
  


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
samba compatibility with microsoft srvtools.exe (usrmgr.exe and srvmgr.exe) checkmate3001 Linux - Software 1 09-06-2008 05:08 AM
Where do I find setup.exe for Steam?? Dark Chibi Linux - Games 1 12-07-2005 06:10 PM
no such file or directory exists when trying to execute a exe ryedawg Linux - Software 5 12-05-2005 05:42 AM
Wine cannot find .exe file belibeli Linux - Software 0 05-18-2004 08:16 AM
Getting cannot find .exe when starting wine kered Linux - Games 4 12-31-2003 04:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:53 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