Skip to content

Instantly share code, notes, and snippets.

@cgrusden
Created January 27, 2020 16:30
Show Gist options
  • Save cgrusden/11164442b2324ff31a5baf9893921fe1 to your computer and use it in GitHub Desktop.
Save cgrusden/11164442b2324ff31a5baf9893921fe1 to your computer and use it in GitHub Desktop.
Utility Scripts
#!/bin/sh
# Rename files in subdirectories to the names of the sub directory
# and place them in the current directory
# This script needs help. but it works
for d in $1*; do
if [ -d "$d" ]; then
echo "Dir: $d"
cp $d/*.html $(echo "$d" | sed -E 's/source\/(.+)?$/source\/\1\.md/g')
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment