Skip to content

Instantly share code, notes, and snippets.

@aerouk
Created July 25, 2019 16:22
Show Gist options
  • Save aerouk/6c108f3b76a8c1ae8f84621d32424980 to your computer and use it in GitHub Desktop.
Save aerouk/6c108f3b76a8c1ae8f84621d32424980 to your computer and use it in GitHub Desktop.
Gets the first jpg in a subdir of the current dir and copies it where the command was executed as the subdir name
#!/bin/sh
for dir in */; do
for file in "$dir"*.jpg; do
cp "$file" "${file%/*}.jpg"
break 1
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment