mockers
Would you like to react to this message? Create an account in a few clicks or log in to continue.

shell script

2 posters

Go down

shell script Empty shell script

Post  udita Sun Feb 01, 2009 9:11 am

u have a pen drive infected with a virus dat makes a copy of it in every folder and subfolders of a directory (can take as /mnt).write a shell script that can delete all .exe and .inf ( ignore case it can be .EXE or Exe) files from all the folders .

udita

Posts : 11
Join date : 2009-02-01

Back to top Go down

shell script Empty Re: shell script

Post  Beagle Sun Feb 01, 2009 4:11 pm

I tried on NTFS drives this script:

rm -rf *.[Ee][Xx][Ee] (because u cannot be sure that exe is of potential threat to your system)

but this script didn't worked(It did not go recursively into the directories)

Try the same script for Pendrive. I think it should work for FAT32.

Beagle

Posts : 40
Join date : 2009-01-30

Back to top Go down

shell script Empty Re: shell script

Post  udita Sun Feb 01, 2009 9:45 pm

the ans which i gave was
cd /mnt
set ls -ldR
for n in $*
rm /n/*.[eExXeE]
rm /n/*.[iInNfF]

udita

Posts : 11
Join date : 2009-02-01

Back to top Go down

shell script Empty Re: shell script

Post  udita Sun Feb 01, 2009 9:55 pm

ls -dR will solve the recursive problem.
but dre is another problem with my code. If the folder name is New Folder ,set will take New and Folder as separate folders.

udita

Posts : 11
Join date : 2009-02-01

Back to top Go down

shell script Empty Re: shell script

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum