- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: link directories (share information between 2 ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2007 06:37 AM
01-09-2007 06:37 AM
I have 2 directories that should have the same information.
/test1
/test2
everytime that i restart the application the files in dir /test1 are updated. I want that also to have the same files in /test2.
Example
if in the dir /test1 I have the following files
the same information I want in the /test2
/test1
file1 file2
/test2
file1 file2
How can I do that?
Thanks
Andy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2007 06:41 AM
01-09-2007 06:41 AM
Re: link directories (share information between 2 dir in the same system)
"man ln" will provide the answer
ln -s
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2007 06:45 AM
01-09-2007 06:45 AM
Re: link directories (share information between 2 dir in the same system)
$ mkdir test1
$ touch test1/file1 test1/file2
$ ls test1
file1 file2
$ ln -s test1 test2
$ ls -F
test1/ test2/
$ ls -L test2
file1 file2
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2007 06:55 AM
01-09-2007 06:55 AM
Re: link directories (share information between 2 dir in the same system)
root@app06 # cd ../test1
root@app06 # touch file1
root@app06 # touch file2
root@app06 # touch file3
root@app06 # ls -ltr /test1/
total 0
-rw-r--r-- 1 root other 0 Jan 9 14:53 file1
-rw-r--r-- 1 root other 0 Jan 9 14:53 file2
-rw-r--r-- 1 root other 0 Jan 9 14:53 file3
root@app06 # ls -ltr /test2/
total 2
lrwxrwxrwx 1 root other 5 Jan 9 14:52 test1 -> test1
root@app06 # ls -ltr /test2/
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2007 08:23 AM
01-09-2007 08:23 AM
Solution# cat .mytest
#!/usr/bin/sh
mkdir /tmp/test1
mkdir /tmp/test2
touch /tmp/test1/file1 /tmp/test1/file2 /tmp/test1/file3
ln -s /tmp/test1/file1 /tmp/test1/file2 /tmp/test1/file3 /tmp/test2
ls -l /tmp/test1
ls -l /tmp/test2
...run:
# ./mytest
/tmp/test1:
total 0
-rw-r----- 1 root sys 0 Jan 9 16:22 file1
-rw-r----- 1 root sys 0 Jan 9 16:22 file2
-rw-r----- 1 root sys 0 Jan 9 16:22 file3
/tmp/test2:
total 0
lrwxr-x--- 1 root sys 16 Jan 9 16:22 file1 -> /tmp/test1/fi
le1
lrwxr-x--- 1 root sys 16 Jan 9 16:22 file2 -> /tmp/test1/fi
le2
lrwxr-x--- 1 root sys 16 Jan 9 16:22 file3 -> /tmp/test1/fi
le3
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2007 07:35 PM
01-10-2007 07:35 PM
Re: link directories (share information between 2 dir in the same system)
The ln -s solutions don't do that exactly. What they do is make it seem that one directory has two names. You only have one copy of everything. Is this what you want?
>I dont see the the same files on both dirs
You have created a link from test1 to test1, in test2.
You need to do what Peter and PCS said.
>JRF: ln -s /tmp/test1/file1 /tmp/test1/file2 /tmp/test1/file3 /tmp/test2
You may not want to use absolute paths for symlinks. They don't work if you mounting the filesystem over NFS.
Instead use relative links. It is easier to be in /tmp/test2 for this:
ln -s ../test1/* .
I.e. you can push absolute links but you want to pull relative links created by file name completion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2007 07:51 PM
01-10-2007 07:51 PM
Re: link directories (share information between 2 dir in the same system)
as long as you are sharing the directories within the same system, there should not be any problem using the full path for specifying the paths.
kind regards
yogeeraj