Link to a directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Link to a directory
# 1  
Old 01-28-2009
Link to a directory

Hi Experts,

Is there any way to link the contents (subdirectories/files) of a existing directory A to another existent directory B..

The relative path of /root/Directory A/
Directory A
|__ Subdirectory A1
|__File A
|__File B
|__ Subdirectory A2
|__File A
|__File B

The relative path of /root/Directory B/
Directory B
|__ Subdirectory A1
|__File A
|__File B
|__ Subdirectory A2
|__File A
|__File B

Directory B is controlled by a Version Control system, so obviously, we did not want this to be a symbolic link from Directory A. We will be making the modifications on Directory A, which we are expecting to reflect in Directory B.

Lets say, if i modify some contents in File A of the subdirectory A1 of the root directory A, then it should get reflected in the same path of the directory B too.

Your valuable inputs and help appreciated.
# 2  
Old 01-28-2009
Edited by Neo (sorry, I meant to reply, but accidently edited this post!)

Code:
ln Directory_A/* Directory_B

The above example is a hard link, not a symbolic link, so it will not work, use

Code:
ln -s


Last edited by Neo; 01-29-2009 at 06:51 AM.. Reason: Need symbolic link, not hard link...
# 3  
Old 01-29-2009
Thanks John, The file systems are different. I am testing in two different filesystem, /home/user is one filesystem and /base/projects is another filesystem. But actually, in realtime, the directories are in the same filesystem

Does it mean that the links doesn;t work in different filesystems. Please guide.

I tried as below and i am getting an error when trying to link the directories

user@host:/home/user/wa/directory_A/$ ln /base/projects/directory_A/* /home/user/wa/directory_A
ln: 0653-423 /base/projects/directory_A/Sybase_Scripts is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/Utilities is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/action is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/bin is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/generalLedger is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/hedgeScenarios is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/instSource is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/sqlsource is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/tk is a directory. Cannot hard link.
# 4  
Old 01-29-2009
i also tried within the same filesystem and it didn't work either :-(

user@host:/base/projects/$ ln /base/projects/directory_A/* /base/projects/directory_B
ln: 0653-423 /base/projects/directory_A/Sybase_Scripts is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/Utilities is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/action is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/bin is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/generalLedger is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/hedgeScenarios is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/instSource is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/sqlsource is a directory. Cannot hard link.
ln: 0653-423 /base/projects/directory_A/tk is a directory. Cannot hard link.
# 5  
Old 01-29-2009
Then use -s.
Code:
ln -s path_existing path_new

# 6  
Old 01-29-2009
Hi Otheus,

But, in this case, this is not from existing path to a new directory. Both of them are existing already. I am expecting to link both the exsiting directories say, the files modifying the directory A should be modified in directory B as well
# 7  
Old 01-29-2009
"path" refers to the directory+filename. You can softlink directories as well.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Create a Link for a directory

Hi, I need to create a link as stagein01 for the /p11/prod/stagein01/. Please let me know the procedure for the same. Regards, VN (5 Replies)
Discussion started by: narayanv
5 Replies

2. Shell Programming and Scripting

HELP on checking for directory or symbolic link

Hi, Can anyone please advise why the following is not working as I expected it to be? Test script as below: #!/bin/ksh for checkdir in dir* do echo "Checking ${checkdir}" if ; then echo "... ${checkdir} is a directory" elif Output from sample run as below: $:... (8 Replies)
Discussion started by: newbie_01
8 Replies

3. Post Here to Contact Site Administrators and Moderators

Broken Links in the Site Link Directory

(split from another thread) Hi. Can you please post a copy of the exact link you used? I have no trouble accessing either the readme, or the link to "Featured Books and Articles by Active Forum Members - Links" Thanks. (2 Replies)
Discussion started by: Scott
2 Replies

4. UNIX for Dummies Questions & Answers

Symbolic link for an existing directory

Hi , i am trying to make a symbolic link for an existing directory, but i am facng some problems regarding the usage of command. If there is no directory i can make a symbolic link, but for an existing directory i am not able to. can anyone post me the exact usage if we already have the... (1 Reply)
Discussion started by: sahasra
1 Replies

5. UNIX for Advanced & Expert Users

Hard link a directory

Is it possible to Hard link a directory? Some people on google say it is possible and some say it is not possible. I haven't seen a working solution though. (3 Replies)
Discussion started by: cokedude
3 Replies

6. AIX

link directory across server

Hi All, I have directory "A" on server "1". I also have directory "B" on Server "2" I need to link these 2 directories "A" and "B" which are across servers. Is it possible? If so, can somebody help me on this? Thanks in advance. Mugundan (2 Replies)
Discussion started by: mjdarm
2 Replies

7. Web Development

html link to images in /tmp directory

Because of permission issues, I need to link to images in my web page which are stored in /tmp which of course is located in the root directory but my actual html page is much further down in another directory. I thought the the following code should work, but the image comes up as a broken link:... (2 Replies)
Discussion started by: Solerous
2 Replies

8. Solaris

soft link for directory in root FS

Hi, In root folder there is one directory "/usr/sap/P38/TRX00/index" as the data is going to increase so to aviod root fs become 100% full ,we have to create one soft link that would point to another point mount created with on same disk ultimatly that New Fs(/test) will store data instead of... (2 Replies)
Discussion started by: solaris123
2 Replies

9. Shell Programming and Scripting

how link directory

I want to link directory to another directory pls confirm whether i am doing correct or not I want to link test directory to another hist directory /users/test/ ln -s /users/hist pl confirm (1 Reply)
Discussion started by: getdpg
1 Replies

10. AIX

To link a filesystem to a directory

Hi, I was wondering if someone can help me out with one of my simple problems. I have a filesystem, /oracle/dir1/sapdataA. The client has the filesystem /oracle/dir1/sapdata1. Now I want to link these 2 directories so that if I cd to /oracle/dir1 and do an ls -l I get the following output: cd... (3 Replies)
Discussion started by: brookingsd
3 Replies
Login or Register to Ask a Question