Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a script in Unix in which I have to move a file daily to a specific path. In order to avoid overlapping of the file, I want the file name along with the date.

e.g. mv filename /home/bin.
How can I add the date to the file name?

share|improve this question

migrated from stackoverflow.com Mar 25 '12 at 18:12

This question came from our site for professional and enthusiast programmers.

mv "filename.ext" "/home/bin/filename-$(date +%Y%m%d).ext"
share|improve this answer
mv filename.ext{,.$(date +%Y%m%d)}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.