How do I use grep to find all the zip files in a directory?

David Faux

I have a directory with over 1000 files, and a few of them are .zip files, and I want to turn them all into .tgz files.

I want to use grep to make a list of file names. I have tried "grep *.zip" to no avail. Reading the man pages, I thought that * was a universal selector. Why is this not working?

Thank you.

Zoke

You should really use find instead.

find <dir> -iname \*.zip

Example: to search for all .zip files in current directory and all sub-directories try this:

find . -iname \*.zip

This will list all files ending with .zip regarding of case. If you only want the ones with lower-case change -iname to -name

The command grep searches for stings in files, not for files. You can use it with find to list all your .zip files like this

find . |grep -e "\.zip$"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I use grep to find all the zip files in a directory?

From Dev

How do I use grep to search the current directory for all files having a given string and then move these files to a new folder?

From Dev

How to use grep to find *.part files in a directory

From Dev

How to use grep on all files non-recursively in a directory?

From Dev

How to use grep on all files non-recursively in a directory?

From Dev

How do I use grep to find a text string in files in sub folders of a parent folder without -r switch

From Dev

How do I recursively zip all subfolders in a directory?

From Dev

How do I recursively zip all subfolders in a directory?

From Dev

Edit all Files in all ZIP Files in a Directory (Find + Replace)

From Dev

How do I find where all the files are?

From Dev

How do I find the number of all .txt files in a directory and all sub directories using specifically the find command and the wc command?

From Dev

How to use grep command on zip files

From Dev

How do I use all the txt files from a directory with a for loop using python

From Dev

How do I combine my find and grep command to delete the files?

From Dev

How to list all zip files in a directory?

From Dev

Zip all files in directory?

From Dev

How can I find all files open within a given directory?

From Dev

How do I create separate zip files for each selected file/directory in 7zip?

From Dev

How do I use find to copy all found files to a new name in their same directories?

From Dev

How do I grep all \\

From Dev

How do I copy all files recursively to a flat directory in Ruby?

From Dev

How do i run python script on all files in a directory?

From Dev

How do i check for all the files sizes in a directory while in a loop?

From Dev

Bash - how do I wipe the contents of all files in a directory

From Dev

PowerShell: How do I append a prefix to all files in a directory?

From Dev

How do i transcode all files in a directory with ffmpeg

From Dev

How do I open all files in a directory in python?

From Dev

Kiosk Mode - How do I get all files from a directory?

From Dev

How do i run python script on all files in a directory?

Related Related

  1. 1

    How do I use grep to find all the zip files in a directory?

  2. 2

    How do I use grep to search the current directory for all files having a given string and then move these files to a new folder?

  3. 3

    How to use grep to find *.part files in a directory

  4. 4

    How to use grep on all files non-recursively in a directory?

  5. 5

    How to use grep on all files non-recursively in a directory?

  6. 6

    How do I use grep to find a text string in files in sub folders of a parent folder without -r switch

  7. 7

    How do I recursively zip all subfolders in a directory?

  8. 8

    How do I recursively zip all subfolders in a directory?

  9. 9

    Edit all Files in all ZIP Files in a Directory (Find + Replace)

  10. 10

    How do I find where all the files are?

  11. 11

    How do I find the number of all .txt files in a directory and all sub directories using specifically the find command and the wc command?

  12. 12

    How to use grep command on zip files

  13. 13

    How do I use all the txt files from a directory with a for loop using python

  14. 14

    How do I combine my find and grep command to delete the files?

  15. 15

    How to list all zip files in a directory?

  16. 16

    Zip all files in directory?

  17. 17

    How can I find all files open within a given directory?

  18. 18

    How do I create separate zip files for each selected file/directory in 7zip?

  19. 19

    How do I use find to copy all found files to a new name in their same directories?

  20. 20

    How do I grep all \\

  21. 21

    How do I copy all files recursively to a flat directory in Ruby?

  22. 22

    How do i run python script on all files in a directory?

  23. 23

    How do i check for all the files sizes in a directory while in a loop?

  24. 24

    Bash - how do I wipe the contents of all files in a directory

  25. 25

    PowerShell: How do I append a prefix to all files in a directory?

  26. 26

    How do i transcode all files in a directory with ffmpeg

  27. 27

    How do I open all files in a directory in python?

  28. 28

    Kiosk Mode - How do I get all files from a directory?

  29. 29

    How do i run python script on all files in a directory?

HotTag

Archive