Linux – Why is “tar” trying to create an empty archive

backupfile-transferlinuxtar

I'm trying to use tar to tar files before transfer, so I can keep the entire file path rather than losing it along the way. However, when I try to tar an empty folder, it tells me that it is cowardly refusing to create an empty archive. I want to keep the empty folder on the other end, but don't want to put anything else into the archive to make it non-empty. Is there any way to do this?

Best Answer

What command are you using? I am able to create a tar archive of an empty directory just fine:

[jnet@Stan tmp]$ mkdir test
[jnet@Stan tmp]$ tar -cf test.tar test
[jnet@Stan tmp]$ ls -lh test.tar 
-rw-r--r--  1 jnet  wheel    10K Apr 20 21:58 test.tar
Related Question