I have a situation where I need to be able to run a script and delete specific files within a zip archive. Below is the general setup
/mnt/directory /mnt/directory/Folder1 /mnt/directory/Folder1/file1.zip /mnt/directory/Folder1/file2.zip /mnt/directory/Folder2 /mnt/directory/Folder2/Documents /mnt/directory/Folder2/file1.zip /mnt/directory/Folder2/file2.zip
Then within each zip file, there are a lot of files and directories. There could be 20+ directories deep so I need to make sure whatever I do recursively looks into the files.
I have played with the zipinfo -1 /mnt/directory/Folder1/file1.zip '.txt'* command it finds all .txt files in file1.zip, but I can't wildcard the zipinfo command to make it search all zip files. Also, I still need to be able to delete them after the fact. I have also tested zip -d /mnt/directory/Folder1/file1.zip filename.txt. This works fine for 1 file and 1 file only, as long as it's not within a folder. So again, not ideal for my situation.
I can unzip them if needed, but would prefer not as some are very large and I will have to zip them back anyway.