简体   繁体   中英

Compress with rar in separates archive on linux terminal

I have a folder full of files, for example:

  1. File1.mpg
  2. File2.mpg
  3. File3.mpg ..

and I would archive them with rar from terminal in separates archives, I would this result:

  1. File1.rar
  2. File2.rar
  3. File3.rar ..

On windows I haven't problem to do it but on linux I don't find how to do it. I'm using ubuntu 13.04 64bit.

some ideas?

You can use for cycle and I reccomend use zip or gzip for compress.

for f in /path/to/files; do zip -9r "$f.zip" "$f"; done

for f in /path/to/files; do gzip $f; done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM