если в Linux, то для zip есть ключик "d". Вот выдержка из справки
-d Remove (delete) entries from a zip archive. For example:
zip -d foo foo/tom/junk foo/harry/\* \*.o
will remove the entry foo/tom/junk, all of the files that start with foo/harry/, and all of the files
that end with .o (in any path). Note that shell pathname expansion has been inhibited with back-
slashes, so that zip can see the asterisks, enabling zip to match on the contents of the zip archive
instead of the contents of the current directory. You can also use quotes to escape wildcards, as in
zip -d foo foo/tom/junk "foo/harry/*" "*.o"
Under systems where the shell does not expand wildcards, such as MSDOS, the backslashes are not
needed. The above would then be
zip -d foo foo/tom/junk foo/harry/* *.o
Under MSDOS, -d is case sensitive when it matches names in the zip archive. This requires that file
names be entered in upper case if they were zipped by PKZIP on an MSDOS system.
Запускаеш рекурсивно с заданным именем и все
Для rar, тоже самое - ключ "d". Есть еще ключ "r" для рекурсивной распаковки