Correct way of using the --remove-files option with TAR
30,155
Since the -f
argument is telling tar
you are going to speficy the file name of the archive you are acting on, I would keep the archive name right after that argument. The list of files and directories to include in the archive should come last. You can specify --remove-files
before your other arguments like this:
tar --remove-files -cvfj archive.tar.bz2 archive/
Related videos on Youtube
Author by
chattsm
Updated on September 18, 2022Comments
-
chattsm almost 2 years
What is the correct way to use the
--remove-files
option when usingtar
?Is it...
tar -cfvj --remove-files archive.tar.bz2 archive/
Or...
tar -cfvj archive.tar.bz2 archive/ --remove-files
-
iss42 almost 8 yearsproblem with this option for me is that then I no longer get tab completion working on the files part
-
Caleb almost 8 years@iss42 That is a function of your shell's autocompletion patterns not being as smart as they should be, not of incorrect tar usage. You can fix that problem separately.
-
Caleb almost 8 years@iss42 The thing to do is ask a question about how to fix that completion on Unix & Linux and link back to it here.