inital commit
This commit is contained in:
39
convert_7z.sh
Normal file
39
convert_7z.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Date: 02/13/2023
|
||||
# Author: Anthony Correa
|
||||
# I used this script to batch unarchive .7z files.
|
||||
# It will create a folder based on the 7z file name
|
||||
# It will automatically skip if there is a folder already in the output directory
|
||||
|
||||
# Usage: $ ./convert_7z.sh <input_directory>
|
||||
|
||||
# output_directory is the directory where the unarchived folders will go
|
||||
output_directory=./out
|
||||
mkdir -p "$output_directory"
|
||||
for FILE in "$@";
|
||||
do
|
||||
##echo "$fi"
|
||||
echo "========================================================================================"
|
||||
echo "$FILE"
|
||||
|
||||
filename=$(basename -- "$FILE")
|
||||
outname="${filename%.*}"
|
||||
outpath="$output_directory/$outname"
|
||||
##touch "./out/${fi%%.*}.new"
|
||||
|
||||
if [ ! -d "$outpath" ]; then
|
||||
echo "$outpath"
|
||||
7z x "$FILE" -aos -bb1 -o"$outpath"
|
||||
else
|
||||
echo "$outpath exists... skipping"
|
||||
fi
|
||||
done
|
||||
echo "========================================================================================"
|
||||
echo "Done unarchving"
|
||||
|
||||
# at one point I wanted to tar the results to make it easier to transfer all the contents
|
||||
# i commented it out.
|
||||
#echo "now tarring"
|
||||
#tar -cvf out.tar "$output_directory"
|
||||
echo "Done!"
|
||||
Reference in New Issue
Block a user