Created
June 18, 2023 20:29
-
-
Save eguneys/5fd540f5506423e5384f26bd6fb742c1 to your computer and use it in GitHub Desktop.
extract files in all folders into a single folder.
This file contains 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
tmp_dir="/tmp/xyz_data" | |
mkdir -p "$tmp_dir" | |
for folder in "$source_dir"/*; do | |
if [ -d "$folder" ]; then | |
folder_name=$(basename "$folder") | |
cp "$folder"/* "$tmp_dir" | |
fi | |
done | |
mv "$tmp_dir" "$destination_dir" | |
count=$(ls -p "$destination_dir" | grep -v / | wc -l) | |
echo "done $count files." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment