Skip to content

Instantly share code, notes, and snippets.

@sagarishere
Created January 24, 2024 08:27
Show Gist options
  • Save sagarishere/bd676f4ed5411ff695382092aaa07a0b to your computer and use it in GitHub Desktop.
Save sagarishere/bd676f4ed5411ff695382092aaa07a0b to your computer and use it in GitHub Desktop.
namechange.sh
#!/bin/bash
# Ask the user for a number
echo "Enter the number to prefix the file names with:"
read number
# Iterates over each file in the current directory
for file in *; do
# Skips the script itself
if [ "$file" != "namechange.sh" ]; then
mv "$file" "${number}.${file}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment