Created
December 7, 2015 16:29
-
-
Save mfurlend/bcdc91eda82fc7f0e539 to your computer and use it in GitHub Desktop.
recursively rename base name of files to parent folder's name (bash)
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 | |
for dir in *; do | |
if test -d "$dir"; then | |
( | |
cd $dir | |
for file in *; do | |
newfile=$dir.${file#*.} | |
mv "$file" "$newfile" | |
done | |
) | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment