0

I have multiple zip files in a parent folder as well as subfolders. I would like to replace all those zip files with a dummy zip file. In other words:

 * the original zip file content being replaced by the dummy zip file  
 * the original zip file name will remain as it is  
 * the origin zip file path will remain as it is  

Would you please let me know how I can achieve this.

  • and the original zip files should be overwritten == removed? – pLumo Sep 14 '18 at 11:56
  • Suppose: I have ./main/subdir/somefile.zip and /path/to/dummy.zip files. I want to replace ./main/subdir/somefile.zip file with /path/to/dummy.zip (preserving name and path) – MagePsycho Sep 14 '18 at 11:58
2

try this,

find /some/path/ -iname "*.zip" -exec cp -f /path/to/dummy.zip {} \;

Change /some/path to the folder you like to search for the zip-files.

Warning: this will remove the original contents of all zip-files below /some/path.

  • That works great!! @Rovo – MagePsycho Sep 14 '18 at 12:31
  • How to find types of file in a directory? – MagePsycho Sep 14 '18 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.