I'm using the command p7zip to compress files. There is not enough space on the disk even to store the compressed file. I'm compressing a directory where there are thousands of file, is there any way of compressing and deleting files at the same time so as to be able to do the compression with the limited space, or is there any other solution ?

  • If you have the room to compress one file at a time, you can use gzip, which will delete the source file by default once the compressed copy has been created. – DopeGhoti May 17 '17 at 17:15
  • yes I do have room for one file, what are the options for doing this ? – Noor May 17 '17 at 17:46
  • cd /path/to/tonsofiles; gzip * – DopeGhoti May 17 '17 at 17:59
  • The thing is that I have several subdirectories in the parent directory which i want to compress – Noor May 17 '17 at 18:18
  • find /path/to/tonsofiles/ -type f -exec gzip "{}" \; – DopeGhoti May 17 '17 at 18:33

Your Answer

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

Browse other questions tagged or ask your own question.