Solved

softlink directories content recursive

Posted on 2003-12-03
4
283 Views
Last Modified: 2010-04-22
Hi,

I need to softlink recursively all files/folders in a dirctory.
It's a VERY large corpus and i don't want to spend weeks on that ;)

think a simple bash script should handle that, right?
Got no experience with bash though :(

depth is only 3.

big THX for any help,


/riplix

0
Comment
Question by:riplix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 7

Accepted Solution

by:
glassd earned 101 total points
ID: 9870020
Not sure exactly what you want to do.

If you link the base directory to a new name, then the whole structure would appear to be duplicated in the new place.

If you REALLY need to link all the files then I suspect a mixture of shell and the 'find' command will do what you want.

Assuming that this is the requirement.

Real structure:

a1
  a1b1
    a1b1c1
    a1b1c2
  a1b2
    a1b2c1
    a1b2c2
a2
  a2b1
    a2b1c1

and you want to link this to a new location somewhere else, then consider the following:

The find command will give you a list of all the files with their relative path from the start point.

find .
will result in the output:
./a1
./a1/a1b1
./a1/a1b1/a1b1c1
./a1/a1b1/a1b1c2
./a1/a1b2
./a1/a1b2/a1b2c1
./a1/a1b2/a1b2c2
./a2
./a2/a2b1
./a2/a2b1/a2b1c1
   
Assuming you want to link every file to a structure on /data1

#!/bin/bash
for File in $(find .)
do
   ln -s $File /data1
done

this assumes you want symbolic links rather than hard links. Remember that hard links are restricted to the same file system.

If I have totally misunderstood the question then ignore all the above.  
0
 

Author Comment

by:riplix
ID: 9870184
softlinks yes. cuz i am mustn't manipulate the source data at all.
@glassd: i think you got it right, though i havn't checked on it yet.
please see
http://www.experts-exchange.com/Programming/Programming_Platforms/Linux_Programming/Q_20815297.html#9870044
for some more details on what i'd like to do.

THX so far
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question