shell script
2 posters
shell script
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
Re: shell script
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.
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
Re: shell script
the ans which i gave was
cd /mnt
set ls -ldR
for n in $*
rm /n/*.[eExXeE]
rm /n/*.[iInNfF]
cd /mnt
set ls -ldR
for n in $*
rm /n/*.[eExXeE]
rm /n/*.[iInNfF]
udita- Posts : 11
Join date : 2009-02-01
Re: shell script
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.
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
Permissions in this forum:
You cannot reply to topics in this forum
|
|