making a directory tree:
Ralph W. Reid
rreid at sunset.net
Fri Jun 17 14:10:23 EDT 2005
Here is a little script which might do the trick.
#!/bin/bash
#Create hard links for all files in directories 1, 2, 3, and 4, placing
#those new links in a specified destination directory.
#Include directory names in file names to keep files from overwriting each other.
#IMPORTANT!!! This script assumes that the four directories to be read from
#do not include subdirectories of their own. If they do, duplicate file
#names _might_be produced. This is because the slashes in path names
#are simply replaced with hyphens.
#This simple script could use some optimizing for more general use, but
#it should suffice for the specified task.
#define the destination directory
destinationdir=./alldirs
#first, be sure that the '$destinationdir' directory exists
mkdir $destinationdir > /dev/null 2> /dev/null
#create the links
for i in 1/*
do
ln $i $destinationdir/`echo $i | tr '/' '-'`
done
for i in 2/*
do
ln $i $destinationdir/`echo $i | tr '/' '-'`
done
for i in 3/*
do
ln $i $destinationdir/`echo $i | tr '/' '-'`
done
for i in 4/*
do
ln $i $destinationdir/`echo $i | tr '/' '-'`
done
HTH, and have a _great_ weekend!
On Fri, Jun 17, 2005 at 12:02:30AM -0400, Sina Bahram wrote:
> Yes, I understand that ... And I am asking you ... How do you propose to
> handle name collision conflicts?
>
> Take care,
> Sina
>
> -----Original Message-----
> From: speakup-bounces at braille.uwo.ca [mailto:speakup-bounces at braille.uwo.ca]
> On Behalf Of Steve Dawes
> Sent: Thursday, June 16, 2005 10:13 PM
> To: Speakup is a screen review system for Linux.
> Subject: RE: making a directory tree:
>
> no, think about it.
> You have a set of isos that you have mounted and now you want to make them
> appear as a single volume. That is what I am trying to do.
>
>
> Steve
>
>
>
> -----Original Message-----
> From: speakup-bounces at braille.uwo.ca
> [mailto:speakup-bounces at braille.uwo.ca]On Behalf Of Sina Bahram
> Sent: Thursday, June 16, 2005 8:35 AM
> To: 'Speakup is a screen review system for Linux.'
> Subject: RE: making a directory tree:
>
>
> Symbolic links could definitely work, but that's just one level away.
>
> As for having all the files from different directories in one directory ...
> wouldn't this be impossible to do with any command?
>
> Think about it .. If I have the directories, 1 and 2, and inside 1 I have a
> file called a.txt and inside 2 I have a file called a.txt .. That's
> perfectly fine, but if they merge ... *whistle*
>
> Take care,
> Sina
>
> -----Original Message-----
> From: speakup-bounces at braille.uwo.ca [mailto:speakup-bounces at braille.uwo.ca]
> On Behalf Of Joseph C. Lininger
> Sent: Thursday, June 16, 2005 10:00 AM
> To: sdawes at telus.net; Speakup is a screen review system for Linux.
> Subject: Re: making a directory tree:
>
> Hello,
> You can't use the mount --bind call to mount more than one directory or file
> at a time. In other words, you can only specify a single source and a single
> target. If you want to have all subdirectories available in a single
> directory, I suggest using the "ln" command to create symbolic links to the
> directories you are attempting to access.
>
> Equal causes can produce very unequal effects.
> Joseph C. Lininger
> jbahm at pcdesk.net
> Verification: 5eab38a77ac40416e075be8f50607ff7
>
> And so it came to pass that on Wed, 15 Jun 2005, Steve Dawes said
>
> > Can anyone give me any suggestions as to how they would resolve the
> > following:
> >
> > I have four directories, let's call them 1 2 3 4.
> > Now what I would like to do is have the contents of these directories
> > available in a single directory tree, let's call it alldirs.
> >
> > I am quite familiar with mount --bind and its strengths, but I cannot
> figure
> > out how .
> > For example, mount --bind 1 alldirs, will expose the contents of 1 in
> > alldirs, as though the contents of 1 are actually now in alldirs.
> > However, I cannot figure how to do something similar that would allow
> me to
> > combine four directories into one directory tree.
> > I have tried:
> > mount --bind 1,2,3,4 alldirs
> > mount --bind 1 2 3 4 alldirs
> > mount --bind 1:2:3:4 alldirs
> > and none of these work.
> >
> > Any ideas?
> >
> > Steve
> >
> > Steve Dawes
> > Calgary Canada.
--
Ralph. N6BNO. Wisdom comes from central processing, not from I/O.
rreid at sunset.net http://personalweb.sunset.net/~rreid
...passing through The City of Internet at the speed of light!
SEC (x) / COSEC (x) = (TAN (x) / COTAN (x)) ^ 2
More information about the Speakup
mailing list