Solved

softlink directories content recursive

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

15 Experts available now in Live!

Get 1:1 Help Now