How do I tar a directory of files and folders without including the directory itself?

前端 未结 18 684
孤城傲影
孤城傲影 2021-01-29 17:04

I typically do:

tar -czvf my_directory.tar.gz my_directory

What if I just want to include everything (including any hidden system files) in my_

18条回答
  •  旧巷少年郎
    2021-01-29 17:47

    cd my_directory && tar -czvf ../my_directory.tar.gz $(ls -A) && cd ..
    

    This one worked for me and it's include all hidden files without putting all files in a root directory named "." like in tomoe's answer :

提交回复
热议问题