I'm trying to change the files generated by an app that unfortunately often contain spaces. I have managed to get "echo" to give me output that works if copy pasted into terminal, but when I try to do the command, it does not work. I looked at this answer, which has helped me before, but even this "${x}" syntax does not seem to work, in this case.
#!/bin/sh
cd ~/Data
IFS=$'\n';for i in $(ls); do
echo "$i";
filename="$i"
date=$(date -n +%Y-%m-%d)
new_filename="$date$filename"
echo mv \'"${filename}"\' \'"${new_filename}"\'
mv \'"${filename}"\' \'"${new_filename}"\'
done;
Aucun commentaire:
Enregistrer un commentaire