Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • what's Renamer? Commented Aug 28, 2016 at 6:32
  • 1
    The shell assigns the first argument, Rename in this case, to $0 which the shell would use as the script name if the shell had to generate an error message. If you don't care about possible error messages and just want to shorten the command, you could replace Renamer with _. Commented Aug 28, 2016 at 6:36
  • 1
    Why start a new shell? Couldn't you just do -execdir mv {} "$(uuidgen).ext" \;? Is this just to get better error messages? Commented Aug 28, 2016 at 12:30
  • 1
    @Cbhihe The {} is part of the find command, not sh: it tells find where to put the file names. As for the Renamer part, it is documented, albeit tersely, as part of the explanation of the shell's option -c. As for why use Renamer instead of some other string, the discussion here may be helpful. Commented Aug 31, 2016 at 18:23
  • 1
    @Cbhihe Yes, that is about it except that the word subshell has a specific meaning and mv is a spawned process but it is not subshell nor does it run in a subshell. Separately, if efficiency is a concern, I added code to the answer that runs only one shell for every several thousand files found. Commented Sep 1, 2016 at 18:20