Results 1 to 5 of 5
Hi
Let say I have a directory called /opt/archives
In this directory I have some files and the space is filled up at the moment.
I want to create a ...
- 06-18-2010 #1Just Joined!
- Join Date
- Jun 2010
- Posts
- 4
symbolic link for directory
Hi
Let say I have a directory called /opt/archives
In this directory I have some files and the space is filled up at the moment.
I want to create a symbolic link for this directory.
Whenever a file is created in "/opt/archives", it should be created in "/spare/temp" directory.
Since I have enough space in "/spare/temp" , space is issue would be sorted.
How can I achieve this?
- 06-18-2010 #2
First, copy everything that is in the archives directory to /spare/temp/archives (unless you just want everything to spill over into the /spare/temp directory. Then make a link to it from the /opt directory.
Untested...
That should do it.Code:cd /spare/temp mkdir archives cd /opt cp -a archives/* /spare/temp/archives mv archives archive_ORG ## or delete the archives directory ln -s /spare/temp/archives
--- rod.Stuff happens. Then stays happened.
- 06-18-2010 #3Just Joined!
- Join Date
- Jun 2010
- Posts
- 4
Thanks for your reply.
but I didnt get it.
So, in short,
I want to create symbolic link for "/opt/archives" directory to "/spare/temp" directory.
1-) Can I achieve this without moving the files in "/opt/archives" ?
2-) In /opt directory, I tried to issue "ln -s /spare/temp/ /opt/archives/", however it didnt work
- 06-19-2010 #4
1 - You can do it without moving the files, but then they will be obscured by the symbolic link, and inaccessible. I just assumed you'd want to retain access to any existing files.
2 - You can't create a link with a name of something that already exists. In your case, a subdirectory called 'archives' already exists in the '/opt' directory. What you tried to do would have created a link also named archives. That's why my example script renamed it to 'archives_ORG'
I don't think you can give a full absolute filespec as the last argument to 'ln'. It needs to be just a name, or nothing at all, whereupon it will use the last name in the link origin (the way I demonstrated).
--- rod.Stuff happens. Then stays happened.
- 06-19-2010 #5Just Joined!
- Join Date
- Jun 2010
- Posts
- 4
....You can't create a link with a name of something that already exists.
Thanks, thats what I am confused about


Reply With Quote