Solved

softlink directories content recursive

Posted on 2003-12-03
4
266 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

912 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now