bhalash

Bash find unpack

Dec 18th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. find . -maxdepth 1 -type f -regex "^.*\(png\|gif\)$" -exec rm {} \;
  2.  
  3. find                      = Linux find command.
  4. .                         = current directory.
  5. -maxdepth 1               = Depth in folders beyond this one. 1 = /only/ this current folder.
  6. -type f                   = Regular file. -type d = directory.
  7. -regex "^.*\(png\|gif\)$" = "any file ending in PNG or GIF"
  8. -exec rm {}               = Delete this file, represented as {}, by executing the Linux remove command.
  9. \;                        = Terminate the "-exec rm"
  10.  
  11. "Search in this directory for any regular, non-directory file whose name ends with 'gif' or 'png' and delete it."
Advertisement
Add Comment
Please, Sign In to add comment