Skip to content

Instantly share code, notes, and snippets.

@Izzur
Created October 28, 2022 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Izzur/0f80909db0b941b1a8bb02dd57647dc4 to your computer and use it in GitHub Desktop.
Save Izzur/0f80909db0b941b1a8bb02dd57647dc4 to your computer and use it in GitHub Desktop.
Replace space with underscore and backup to s3 with md5 as filename
#!/usr/bin/env bash
for f in *; do
mv "$f" `echo $f | tr ' ' '_'`;
done
for f in *; do
echo $f;
echo $f | md5sum | awk '{print $1}';
aws s3 cp $f s3://bucket-name-something/$(echo $f | md5sum | awk '{print $1}');
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment