From b4d4fc92596390f56e08500e6b82e0fc7c50d784 Mon Sep 17 00:00:00 2001 From: Anthony Correa Date: Wed, 15 Feb 2023 10:39:46 -0600 Subject: [PATCH] inital commit --- convert_7z.sh | 39 +++++++++++++++++++++++++++++++++++ convert_cue_chd.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++ readme.md | 5 +++++ 3 files changed, 95 insertions(+) create mode 100644 convert_7z.sh create mode 100644 convert_cue_chd.sh create mode 100644 readme.md diff --git a/convert_7z.sh b/convert_7z.sh new file mode 100644 index 0000000..572a77f --- /dev/null +++ b/convert_7z.sh @@ -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 + +# 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!" diff --git a/convert_cue_chd.sh b/convert_cue_chd.sh new file mode 100644 index 0000000..e09a7a6 --- /dev/null +++ b/convert_cue_chd.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Date: 02/13/2023 +# Author: Anthony Correa +# I used this script to batch archive bin/cues to CHD. +# It will create a file based on the folder file name +# It should automatically skip if there is a folder already in the output directory + +# Usage: $ ./convert_cue_chd.sh + +# for example, to use a directory with wildcards: +# use with convert_cue_chd.sh */. + +# output_directory is the directory where the unarchived folders will go +output_directory=./out +mkdir -p "$output_directory" +i=1 +for FOLDER in "$@"; + do + ##echo "$fi" + echo $'\n'"=="`printf %03d $i`"/"`printf %03d $#`"=============================================================================" + echo "Input folder: $FOLDER" + + infiles=("$FOLDER"/*.cue) + for INFILE in "$infiles";do + filename=$(basename -- "$INFILE") + outname="${filename%.*}.chd" + outpath="$output_directory/$outname" + ##touch "./out/${fi%%.*}.new" + + if [ ! -d "$outpath" ]; then + echo "Input file: $filename" + echo "Output path: $outpath" + echo $'\n' + chdman createcd -i "$INFILE" -o "$outpath" + # 7z x "$FILE" -aos -bb1 -o"$outpath" + else + echo "$outpath exists... skipping" + fi + done + ((i+=1)) + done +echo "======================================================================================" +echo $'\n' +echo "Done converting" + +# at one point I wanted to tar the results to make it easier to transfer all the contents +# but i changed my mind, so i commented it out. this is here in case i change my mind again. +#echo "now tarring" +#tar -cvf out.tar "$output_directory" +echo "Done!" diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..b033ad9 --- /dev/null +++ b/readme.md @@ -0,0 +1,5 @@ +Scripts used in Feb 2023 to do change some CD file formats. They were original 7z files, but I needed CHD files. + +I took some inspiration from +- [reddit](https://www.reddit.com/r/RetroPie/comments/wgq4eu/comment/ij9krit/) +- [nickheyer/CHDconvert](https://github.com/nickheyer/CHDconvert) \ No newline at end of file