Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

softlink directories content recursive

Posted on 2003-12-03
4
Medium Priority
?
287 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 404 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 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