Single line command to archive a certain amount of folders

Posted by EarthMind on Server Fault See other posts from Server Fault or by EarthMind
Published on 2010-05-14T18:05:30Z Indexed on 2010/05/14 18:14 UTC
Read the original article Hit count: 162

Filed under:

I'm looking for a single line command that archives 5 folders into .tar files (no gzip/bzip needed) in a certain directory and deletes the folders after a successful compression. It has to use the original folder name as file name for the archive too.

So far I've used the current command, which only does one directory per time:

tar -c directory > directory.tar && rm -rf directory

Thanks in advance.

© Server Fault or respective owner

Related posts about compression