Created
January 24, 2024 08:27
-
-
Save sagarishere/bd676f4ed5411ff695382092aaa07a0b to your computer and use it in GitHub Desktop.
namechange.sh
This file contains 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 | |
# 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