I am trying to rename files in current directory by prepending timestamp value using find command like below
find . -type f -exec mv {} $(date +%Y-%m-%d)_{} ;
But getting ‘Can’t move, no such file or directory error’, but appending works well with below command, not sure what is the difference between two.
find . -type f -exec mv {} {}.$(date +%Y-%m-%d) ;
Advertisement
Answer
Try this
find . -type f -exec mv {} $(date +%Y-%m-%d)$(basename {}) ;