find command takes its first argument(s) as director(ies)
in which to perform its action.
A single dot
. represents the current directory.
.. represents the parent directory.) That means your command deletes all files with a
.jpg suffix in (and under) the current directory.
To delete all files with a
.jpg suffix in another directory, for example,
/Users/username/Desktop, you'll simply use
find /Users/username/Desktop -type f -name '*.jpg' -delete
This will also affect all sub-directories.
-maxdepth to limit sub-directory levels. The command
find /Users/username/Desktop -maxdepth 1 -type f -name '*.jpg' -delete
deletes files with the
extension from the
folder only; it doesn't access folders inside (below) the Desktop.