Yes I did remove the export.tar.gz created by the first run
---------- Post updated at 12:41 AM ---------- Previous update was at 12:37 AM ----------
I also tried the pipe command to exclude the *.tar.gz file but looks like it is being processed by the command as well.
"tar: ./export.tar.gz: file changed as we read it"
$ find . ! -name export.tar.gz | tar -cpzf export.tar.gz --files-from -
tar: ./export.tar.gz: file changed as we read it
---------- Post updated at 12:44 AM ---------- Previous update was at 12:41 AM ----------
Actually, this is happening because find is returning the current directory as well. If you do a find . ! -name export.tar.gz the first result is .
This might work.
Yes, it is more than OK. If not when you extract the archive it would overwrite the original /dir/dir1/dir2 directory, if exists, instead of extracting it in the current directory as dir/dir1/dir2
Now, if you really, would like to preserver the full path, and overwrite the original path when extracting, then you use the P flag
The above command still gave me single files.
The output looks like:
-rw-r--r-- user/user 33935 2015-12-05 13:41 ./File1.xml
-rw-r--r-- user/user 67306 2015-12-04 20:43 ./File2.xml
-rw-r--r-- user/user 39804 2015-12-05 15:01 ./File3.xml
---------- Post updated at 02:18 AM ---------- Previous update was at 02:16 AM ----------
The output of the following command:
tar -ztvf export.tar.gz
---------- Post updated at 02:22 AM ---------- Previous update was at 02:18 AM ----------
Looks like this command
$ tar cpzf export.tar.gz /dir/dir1/dir2
Is creating duplicates. I see the tarfile size has outgrown (by 1G ) the tarfile created via
find . ! -name export.tar.gz ! -name . | tar -cpzf export.tar.gz --files-from -