Reputation: 31
I am currently working on a programming project where I have my revisions of a Python module stored in dated directories, that is, I keep every day's revision separate, like a git repository on my laptop. For instance, today's hierarchy is .../workingdirs/12-28-11/fingerpuppet/, where fingerpuppet is my module's directory. How do I make a permanent symbolic or hard link in BASH to the most recent revision, such that it changes its target automatically to say, .../workingdirs/12-29-11/ tomorrow, without my having to change it manually? I've seen what appear to be such links on ftp servers, where there is a 'current' link to the most recent version of a file, but I don't know if that is automatically updated or done so manually.
Upvotes: 1
Views: 175
Reputation: 11616
Instead of creating these symlinks every day, you can setup an alias to change to the most current directory. Add this to your ~/.bashrc
:
alias myprj='cd /absolute/path/to/workingdirs/`date "+%m-%d-%y"`/fingerpuppet'
You can invoke that alias every time you need to change to that directory:
$ myprj
Upvotes: 0
Reputation: 37928
unlink current
ln -s ../workingdirs/$(date +%m-%d-%y) current
Upvotes: 0
Reputation: 56
First thing: have you considered using git or some other vcs for your project? It seems like that would make things easier.
If you'd rather not for some reason, another option would be to set a nightly cron job to create a new directory with today's date, copy all the files over from yesterday, and reset the link to latest to the new directory.
Upvotes: 2