Created
April 18, 2024 23:15
-
-
Save gngdb/f0186e47a6af0e25920dcb538c91f687 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function to untar arxiv source files into a folder | |
untar_arxiv () { | |
# Check if the file has a .tar.gz suffix | |
if [[ $1 == *.tar.gz ]]; then | |
# Extract the base name without the .tar.gz suffix | |
base_name=$(basename "$1" .tar.gz) | |
mkdir -p "$base_name" | |
tar -xvf "$1" -C "$base_name" | |
else | |
# Add the .tar.gz suffix to the filename | |
mv "$1" "$1.tar.gz" | |
# Extract the base name without the .tar.gz suffix | |
base_name=$(basename "$1") | |
mkdir -p "$base_name" | |
tar -xvf "$1.tar.gz" -C "$base_name" | |
rm "$1.tar.gz" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment