How do I tar a directory without retaining the directory structure?

前端 未结 9 1317
[愿得一人]
[愿得一人] 2020-12-23 16:01

I\'m working on a backup script and want to tar up a file directory:

tar czf ~/backup.tgz /home/username/drupal/sites/default/files

This ta

9条回答
  •  甜味超标
    2020-12-23 16:18

    Kindly use the below command to generate tar file without directory structure

    tar -C  -cvzf  filename1 filename2... filename N
    

    eg:

    tar -C /home/project/files -cvzf /home/project/files/test.tar.gz text1.txt text2.txt
    

提交回复
热议问题