#!/bin/bash
# 親フォルダを指定
parent_dir="A" # 必要に応じて変更
# figure内のサブフォルダをループ
for subfolder in "$parent_dir"/*; do
if [ -d "$subfolder" ]; then
echo "Accessing folder: $subfolder"
# サブフォルダ内の操作例
# ファイルリストの表示
ls "$subfolder"
folder_name=$(basename "$subfolder")
echo "$folder_name"
mv "$subfolder/a.png" "$subfolder/a_$folder_name.png"
fi
done
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme