Zum Inhalt springen

Developer Snippets

My little Snippet library.

Neueste Beiträge

  • JS: Mask all except the last four digits
  • Docker, check all log files
  • Delete *.log files older then 30 days
  • Find Files by Age and copy them to another directory
  • Search with grep and zip file results

Kategorien

  • .git
  • #!/bin/bash
  • Allgemein
  • Docker
  • HTML5
  • Javascript
  • Linux
  • Odoo
  • PHP
  • Terminal / Shell / Cli
  • Windows

Schlagwort: zip

Search with grep and zip file results

If you want to save the files resulting from the grep search in a zip archive, use this command:

grep -lrZ "searchstring" ./ | xargs -0 zip -g nameOfZip.zip

Veröffentlicht am 10. November 2020Kategorien LinuxSchlagwörter grep, Linux, zip

Zip files and exclude subdirectories

zip -r zipfile.zip directoryToZip -x  directoryToZip /subdirectoryToExclude/*  directoryToZip/SecondSubdirectoryToExclude /*
Veröffentlicht am 31. Oktober 201931. Oktober 2019Kategorien #!/bin/bash, LinuxSchlagwörter Bash, Linux, zip
Stolz präsentiert von WordPress