Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've this structure

  • 2011-04-18T07.32.19UTC
  • 2011-04-19T07.32.19UTC
  • 2011-04-20T03.15.01UTC

Every night, a new directory based on the current date is created.
I would create a symbolic link on the latest directory created:

mysimlink --> 2011-04-20T03.15.01UTC

But tomorrow I would see

mysimlink --> 2011-04-21T03.15.01UTC

How can I do it?

share|improve this question
Without knowing which operating system and how the "2011-04-21T03.15.01UTC" is being created it is difficult to offer solid advice. –  Mokubai Apr 20 '11 at 11:34

1 Answer 1

You need to write a script which will removes the existing symlink and then creates a new symlink pointing at the directory with today's date. Here is some code:

today=$(date +%Y-%m-%d)

# find today's directory
todayDir=$(ls -d $today*)

# if the directory exists
if [ -d $todayDir ]
    rm -f mysymlink
    ln -s $todayDir mysymlink
share|improve this answer
it works..thanks –  luigia Apr 21 '11 at 6:53

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.