Created
June 13, 2023 06:03
-
-
Save yuki-inaho/76a7e9c9900630b44fdd40bae1b39796 to your computer and use it in GitHub Desktop.
The shell script to extract images whose name is written in whitelist.txt
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
| #!/bin/bash | |
| # ファイルパス | |
| whitelist_file="whitelist.txt" | |
| raw_dir="input" | |
| extracted_dir="extracted" | |
| # extractedディレクトリが存在しない場合は作成する | |
| if [ ! -d "$extracted_dir" ]; then | |
| mkdir "$extracted_dir" | |
| fi | |
| # whitelist.txtから画像名を読み取り、該当する画像をコピーする | |
| while IFS= read -r image_name || [[ -n "$image_name" ]]; do | |
| image_path="$raw_dir/$image_name" | |
| if [ -f "$image_path" ]; then | |
| cp "$image_path" "$extracted_dir" | |
| echo "Copied $image_name" | |
| else | |
| echo "Image not found: $image_name" | |
| fi | |
| done < "$whitelist_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment