Reputation: 613
I use the following command to rename all files with no spaces adding prefix "Hello"
for FILENAME in *; do mv $FILENAME Hello_$FILENAME; done
I use the following command to get unix datestamp
date +%s
How do I replace Hello
with date +%s
output?
Upvotes: 3
Views: 2294
Reputation: 201447
If I understand your question, then you could use the $(date +%s)
command substitution syntax to get the command output (and I suggest quotes) like
for i in *; do mv "$i" "$(date +%s)_$i"; done
Upvotes: 8