12

I'm curious as to what the {} in the following command is actually for?

Example Command:

find /foo/ -name "*.txt" -exec rm -v {} \;

The Man page provided a small blurb but it confused me a little bit:

The string '{}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find.

1 Answer 1

12

That's the symbol that gets replaced by the file name that find comes up with.

3
  • Ah that makes sense and could i add another argument after that?
    – chrisjlee
    Feb 1, 2012 at 16:27
  • 6
    You can add whatever you like: it is just an argument. pretty much like "$a-single-output-file-name" when -exec ends with \; ... but it means "$multiple" "$output" "$filenames" when -exec ends with \+
    – Peter.O
    Feb 1, 2012 at 16:35
  • Good comment by Peter.O :). See also related answer to Question on find -exec Feb 1, 2012 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .