How to create flat tar archive

前端 未结 2 1272
挽巷
挽巷 2020-12-16 17:39

my tree command returns

tmp
`-- t
    `-- e
        |-- foo.ps
        `-- s
            |-- bar.ps
            `-- t
                `-- baz.ps         


        
2条回答
  •  醉话见心
    2020-12-16 18:33

    for GNU tar you can use the --xform argument. It takes a sed expression and applies it on each file name. So for removing all characters up to the last /, you may use:

    tar -c --xform s:^.*/:: your-files
    

提交回复
热议问题