Hopefully, sharing this, to help others facing similar requirements. On second command, we are using r option, which will add files/directories to existing archive file. I think it is best to create the tar elsewhere and then use -C to tell tar the base directory for the compressed files. Please note that, in first command we used option c to create the archive file. tar rvf administration.tar administration/USA/California/ You would use tar only if you would need a compressed archive as a single file. You can use gzip to compress them directly: gzip. In our case, we want to include California subdirectory under USA. Putting every file into a separate tar file doesn't make any sense in this scenario. but the idea is to compress the source directory and copy only the compressed file. Then we add required subdirectories to already created tar file. Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn. tar cvf administration.tar -exclude="USA" administration/ So, first we create tar file excluding USA directory altogether without compression. Tar supports adding files to existing tar archive file, however it cannot add files to compressed archive files. We can avoid having above mentioned very long tar command by splitting it. Thus it will be irritating to write all 50 USA state names like that. But it will become very long as we have to write down each USA state names. Normally, we can write a tar command containing -exclude options for each USA states except California. To archive administration directory including all of its sub contents and to exclude USA states other than California. Of course we can use -exclude option of tar, but we will end up having large number of -exclude options added in the command.Ĭonsider that the directory which we are going to archive is administration, with following structure: administration/ But we need to include only one or few subdirectories within a directory which already contains large number of other sub directories. Hey All:Anyone have any recommendations for products to not just clean laptops but to DISINFECT?My team has been using Lysol wipes for the keyboards and body, but using WHOOSH for the screen itself.As you know, screens collect spittle and other human oils.Īnyone else have an issue with decision makers not giving two thoughts about sharing the data they hold on other people with other companies in the name of their own bottom line?Today there are entire industries that simply want your companies data so the.Consider the situation where we want to create a compressed archive file for a directory using tar command.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |