Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    suppress error messages using 'find'


    I'm using find to select groups of files. Sometimes there are not matching filenames such as *.rm, *.flv and find complains. I don't seem to find a way to suppress this output. Anyone know find well enough to know? There are many confusing options.

    I have a script:
    Code:
    find *.mp4 *.flv *.wmv *.avi *.m4v *.rm  -printf "srm -vrll \"%f\" &\n" >out.sh

    Such as:

    Code:
    $ mksrm.sh
    find: `*.flv': No such file or directory
    find: `*.m4v': No such file or directory
    find: `*.rm': No such file or directory
    mode of `out.sh' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
    $
    Thanks

    Jack

  2. #2
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103
    2 is the file descriptor for stderr so you can follow a command with 2>/dev/null. /dev/null is a bottomless pit from which bits never seen again.
    Code:
    find *.mp4 *.flv *.wmv *.avi *.m4v *.rm  -printf "srm -vrll \"%f\" &\n" 2>/dev/null >out.sh
    This will hide any error messages you want to see as well.

  3. #3
    Gregm: Thanks, I may end up using that. I was hoping that there was an option to just suppress errors as in other commands.

    Thanks

    Jack

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103
    You could try -nowarn but I don't think it stops those type of messages.

  6. #5
    -->
    Gregm: I tried that and another one that was kind of a shot in the dark, but didn't help. I may end up with pipping it to dev/null after all.

    Thanks again

    Jack

Posting Permissions

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