← Back to Gists

Rename files in batch

📝 Bash
theresawilliams366
theresawilliams366 · Level 2 ·

This snippet renames multiple files at once using a bash loop with pattern matching.

Bash
for file in .txt; do if [[ -f "$file" ]]; then newname="${file%.txt}backup.txt" mv "$file" "$newname" fi
done

Comments

No comments yet. Start the discussion.