find worms that have same name *.exe with the directory ???
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.)
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. ^^
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"
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 ^^.
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.
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.)
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.