How to execute more than one command with find -exec?

From: Cheng Mo (mo.cheng_at_nospam.nospam)
Date: 11/18/04

  • Next message: chino: "Re: Copy files without changing ownership and permissions"
    Date: Thu, 18 Nov 2004 17:35:30 +0800
    
    

    The scenario is:
    In folder XXX there are lots of *.gif files. Those *.gif files whose
    filename don't appear in file abc.txt should be deleted. I want to do
    this job in one line command.
    find XXX -name "*.gif" -exec ........... \;
    But I don't know how to write the part of ..............

    I tried
    find XXX -name "*.gif" -exec grep {} abc.txt || rm {} \;
    But it seems -exec don't take behind as a combination of two commands.
    Anybody can tell me how to execute more than one command with find -exec?
    Thanks


  • Next message: chino: "Re: Copy files without changing ownership and permissions"

    Relevant Pages

    • Can I compress GIF files the same way I do JPG files ?
      ... I normally run this command from the shell to create thumbnails: ... Is there something similar for GIF files, or should I find a GIF to JPG ...
      (comp.unix.sco.misc)
    • Shell program 2nd question
      ... In one command, following this: ... I want to make TWO greps on the result. ... So I could have the .so and the .gif files on the RPM. ...
      (comp.os.linux.misc)
    • Find Question
      ... I am trying to write a find command that will list all jpg or gif files under my home direcotry. ...
      (comp.unix.questions)
    • Re: Cannot delete file..Zero Bytes?
      ... Open a Command Prompt and use the old DOS command "Dir", ... Navigate to the directory where your zero-byte file is. ... that are not allowed in an 8.3 filename. ... create a new folder and move everything EXCEPT the ...
      (microsoft.public.windows.vista.file_management)
    • Re: Un-erasable folder
      ... > enclose the entire filename (including the path if you are not in its ... Enclose IN QUOTES, of course. ... Like the former deltree command. ... > entire folder name, so the second method may be easier. ...
      (microsoft.public.windows.file_system)