Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 have a script to backup some directories:

tar cjf /backup-`date +\%m-\%d-\%Y`.tar.bz2 mydir >> /dev/null 2>&1

At the end of the process, a "ls -al" show something like:

-rwxr-xr-x 1 my my    719110144 May 29  2000 backup-08-02-2013.tar.bz2

Notice the year: 2000. Archive was made in 2013… What's the problem and how to solve it?

Thanks for your help.

share|improve this question
Have you checked the date & time of the computer (using date)? :-) – Cristian Ciupitu Aug 30 '13 at 0:21
@CristianCiupitu: The filename tells us the output from date +%m-%d-%Y. – Scott Aug 30 '13 at 1:20
up vote 1 down vote accepted

If your archive is being written to a network file system (like NFS or AFS), then make sure the file server has the right date set, as the timestamp of the newly-created file will be determined by the file server's clock. If you can't fix things on the server side, then you'll most likely have to correct the timestamp manually after file creation.

share|improve this answer
Thanks, you're right. The NAS date was'nt correct. – Greg Aug 30 '13 at 6:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .