Sign up ×
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.

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 Mar 25 '12 at 18:12

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

2 Answers 2

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.