简体   繁体   中英

how to create tar file so that files at placed at root folder of tar.gz file

I need to create targ.gz file and contents of file should be at root folder

say. I want angle and Simple files at root of tarfile shown at bottom. Any suggestions. I tried as below but extra folder is created at root

tar -zcvf tarfile.tar.gz -C /example/tarFile .
./
./angle.txt
./Simple.jar

tar -zcvf tarfile.tar.gz -C /example/tarFile .
./angle.txt
./Simple.jar

Please try this

tar -czvf tarfile.tar.gz /example/tarFile

after creating tar file use cp or mv command to move anywhere you want.

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