I am trying to rename files in current directory by prepending timestamp value using find command like below
JavaScript
x
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.
JavaScript
find . -type f -exec mv {} {}.$(date +%Y-%m-%d) ;
Advertisement
Answer
Try this
JavaScript
find . -type f -exec mv {} $(date +%Y-%m-%d)$(basename {}) ;