Search code examples
linuxtarbsdtar

Is there an equivalent --mtime option for bsdtar?


I need to use bsdtar to create an archive and set the modification time the same way as I would do with tar (with --mtime=date option), but I cannot find any equivalent option for bsdtar. I need to use bsdtar because with tar I have issues with extended attributes. Any suggestions?


Solution

  • If you don't absolutely have to do this as an argument passed to bsdtar, you can change any file's mtime with touch (requires root privileges): touch -d "<time>" <filename>.

    See https://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file

    Otherwise this seems to be impossible to do in the exact way you described.