Solved

softlink directories content recursive

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
File system unmounted 3 156
LocalRepositoryNotAccessible error when running maven 1 66
KVM vs  Qemu 4 111
Linux Search 3 67
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

786 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