Skip to content

Instantly share code, notes, and snippets.

@Niklas9
Last active September 15, 2017 20:22
Show Gist options
  • Save Niklas9/cc5bff21fc8b2dcf5d1575e3b578ee3e to your computer and use it in GitHub Desktop.
Save Niklas9/cc5bff21fc8b2dcf5d1575e3b578ee3e to your computer and use it in GitHub Desktop.
shell script to extract files in-place from a tar archive
#!/bin/bash
if [ $# -eq 0 ]
then
echo "missing argument for file path to tar-archive"
exit 1
fi
for file in $(tar -tf $1);
do
tar -xvf $1 $file
tar --delete -f $1 $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment