When I run the command zip arch.zip *
, intending to add only the files in the pwd and none of its subdirectories, I instead get an archive containing all the files and all the subdirectories of the pwd although inside the archive the added subdirectories do not have any files in them. Clearly -r
would be used to populate those subdirectories, but how do I prevent the empty subdirectories from being added to the archive at all?
Please note that the command is being run from a Bash script and I can not simply exclude any subdirectories by name because I won't know in advance which subdirectories will be present.
Surely I don't have to write a routine in the script to loop through the directory's files, individually adding them based on their file type?