Compress Each Folder With One Archive if Archive Is Not Exist
The provided command is a shell script written in Bash that iterates through directories in the current directory, checks if an archive file (.tar.gz) already exists for each directory, and if not, it creates a compressed archive of the directory using the tar
command.
Here’s an explanation of what the script does:
|
|
-
for dir in
find . -maxdepth 1 -type d | grep -v “^.$”; do
: This line starts a loop that iterates through all subdirectories (excluding the current directory) in the current directory.