I'm new to the shell/bash area. I've created this little script to change a name using the
date command. The idea is to get something like this
And it works, but I get the old file name
2020-02-1.txt added to the output.
This is my code so far:
# FOR LOOP TO RENAME FILES cd /home/atlas/Documents/bash/CARPETA-ORIGEN #UBICAR LA CARPETA FILES=$(ls *.txt) NEW="$(date +"%Y-%m")" for FILE in $FILES do echo "Renaming $FILE to new-$FILE" mv $FILE $NEW-$FILE done