Find the answer to your Linux question:
Results 1 to 5 of 5
hello, I am trying to use find and remove to get rid of known viruses by name. I am using: # find [path] -iname "file name" --exec rm -vi {} ...
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Posts
    90

    find and rm commands

    hello,

    I am trying to use find and remove to get rid of known viruses by name. I am using: # find [path] -iname "file name" --exec rm -vi {} \;, and this works perfect, BUT, how do i ask for more than one file name? like # find [path] -iname "file one" "file 2" --exec rm -vi {} \; i am not sure how to do the syntax right. this one does not work

  2. #2
    Linux User fernape's Avatar
    Join Date
    Dec 2005
    Location
    Holland
    Posts
    301
    You can write the name of all the files that you want to delete or (better) you can write a regular expression to match all that files.

    Best Regards

  3. #3
    Just Joined!
    Join Date
    Nov 2006
    Posts
    90
    thanks for the help but i tried that and i cant get the syntax down. could you write an example out to go by? thank you

  4. #4
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Make a file called testfile containing the names of the virii, each on their own line. I did this in a small little test directory to make sure it worked for you. I couldn't get rm interactively, and --exec gave me predicate errors... Anywho, after this command you will have all the files in a quarantine directory anyways. Once they're there, you can do whatever you want. Sorry if it's kinda dirty lol

    Code:
    cat test/testfile.txt | xargs -i[replace] find ./test -iname [replace] | xargs -i[replace] mv [replace] ./test/quarantine

  5. #5
    Just Joined!
    Join Date
    Nov 2006
    Posts
    90
    thanks for all the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...