[comp.sys.amiga] Moving directories

dan@ivucsb.UUCP (Dan Howell) (03/18/89)

I just did something the other day which I had to gloat over.  I had a disk
which had one (count 'em, 1) directory on it.  I decided this was silly,
especially since that directory contained 1 other directory and 1 file.
The directory was a huge tree-structured directory.  I just said

cd dir1
rename file /
rename dir2 /
cd /
delete dir1

And voila, no more useless top level directory.  Try that on an IBM!

(and by the way, I also noticed that you can do this on BSD Unix, but not
on Sys V!  Why would AT&T do this?  Are they trying to be IBM compatible? :-)

-- 
-- Dan Howell  <ivucsb!dan@anise.acc.com>
--             <...!(pyramid|ucbvax)!ucsbcsl!nessus!ivucsb!dan>
-- "What?  TWO buttons?  I don't know if I can handle that!" -- a Mac user

brant@uf.msc.umn.edu (Gary Brant) (03/19/89)

In article <614@ivucsb.UUCP> ivucsb!dan@anise.acc.com (Dan Howell) writes:
>
>cd dir1
>rename file /
>rename dir2 /
>cd /
>delete dir1
>
>And voila, no more useless top level directory.  Try that on an IBM!
>
>(and by the way, I also noticed that you can do this on BSD Unix, but not
>on Sys V!  Why would AT&T do this?  Are they trying to be IBM compatible? :-)

Sys V requires you be Super User to mv directories.  Dunno why, it's
a pain.


>-- Dan Howell  <ivucsb!dan@anise.acc.com>
>--             <...!(pyramid|ucbvax)!ucsbcsl!nessus!ivucsb!dan>


-Gary Brant

monty@sagpd1.UUCP (Monty Saine) (03/21/89)

>In article <614@ivucsb.UUCP> ivucsb!dan@anise.acc.com (Dan Howell) writes:
>>
>>cd dir1
>>rename file /
>>rename dir2 /
>>cd /
>>delete dir1
>>
>>And voila, no more useless top level directory.  Try that on an IBM!
>>
>>(and by the way, I also noticed that you can do this on BSD Unix, but not
>>on Sys V!  Why would AT&T do this?  Are they trying to be IBM compatible? :-)
>
>Sys V requires you be Super User to mv directories.  Dunno why, it's
>a pain.

Thats funny, I just suspended news for a moment on my system V Unix system
and created a directory, moved up to its parent and then did a mv and it moved
it with no problem. True you can't move a directory unless you have the 
correct permission, but in a multi-user system you don't want just anyone
moving around the common directories so they are only accessable by the
superuser, not a pain but a protection.
    Unix is a bit obscure at times but most of the ragging it seems to
take is from people who THINK they can't do something so it becomes gospel.
    In short, as I have been told before, RTFM and get your facts straight
before you rag on ANY system, be it Amiga, Unix, IBM, Atari, etc. There is
not a perfect system out there (yet).

    Flame me via e-mail and don't tie up the net.

Monty

"	All side effects are effects."
"	We can never do merely one thing."
"			--First Law of Ecology"

brant@uf.msc.umn.edu (Gary Brant) (03/21/89)

In article <363@sagpd1.UUCP> monty@sagpd1.UUCP (Monty Saine) writes:
>
>>In article <614@ivucsb.UUCP> ivucsb!dan@anise.acc.com (Dan Howell) writes:
>>>

	[example of moving directory on Amiga deleted]

>>>And voila, no more useless top level directory.  Try that on an IBM!
>>>
>>>(and by the way, I also noticed that you can do this on BSD Unix, but not
>>>on Sys V!  Why would AT&T do this?  Are they trying to be IBM compatible? :-)
>>
>>Sys V requires you be Super User to mv directories.  Dunno why, it's
>>a pain.
>
>Thats funny, I just suspended news for a moment on my system V Unix system
>and created a directory, moved up to its parent and then did a mv and it moved
>it with no problem. True you can't move a directory unless you have the 
>correct permission, but in a multi-user system you don't want just anyone

You probably just used mv to change its name; this is allowed.  What you
can't do is to *move* the directory into a different directory without
superuser permissions.  In order to achieve the same funcionality, I 
have to create a new directory at the location where I wanted to move this
one and then move all the files to the new directory, finally I need to 
delete the now empty directory.  Note that no such contortions are needed
on BSD systems;  I need only type: mv dir1 dir2 & the system will cause dir1
to become a subdirectory of dir2.  On Sys V, I just get the error message,
mv: directory rename only - even though I own both directories & have chmod 
777 on both of them.

I repeat, this is a pain.

>moving around the common directories so they are only accessable by the
>superuser, not a pain but a protection.

	[irrelevant stuff deleted to make pnews happy]

It should still let me move my own directories around.


>    Flame me via e-mail and don't tie up the net.
>
>Monty
>
>"	All side effects are effects."
>"	We can never do merely one thing."
>"			--First Law of Ecology"




-Gary Brant		ARPA:	brant@uf.msc.umn.edu

higgin@cbmvax.UUCP (Paul Higginbottom MKT) (03/22/89)

In article <11719@umn-cs.CS.UMN.EDU> brant@uf.msc.umn.edu (Gary Brant) and others write:
$ [stuff about moving directories under unix]

Can you move this discussion to a unix group please?

	Paul.

sparks@corpane.UUCP (John Sparks) (03/23/89)

<11719@umn-cs.CS.UMN.EDU>

> >>In article <614@ivucsb.UUCP> ivucsb!dan@anise.acc.com (Dan Howell) writes:
> >>>
> 
>    [example of moving directory on Amiga deleted]
> 
> >>>And voila, no more useless top level directory.  Try that on an IBM!
> >>>
> >>>(and by the way, I also noticed that you can do this on BSD Unix, but not
> >>>on Sys V!  Why would AT&T do this?  Are they trying to be IBM compatible?
:-)
> >>
> >>Sys V requires you be Super User to mv directories.  Dunno why, it's
> >>a pain.

Try this little shell script I wrote on SYS V:

# mvdir
echo "moving $1 to $2"
find $1 -print | cpio -pd $2
# remove the comment on the next line if you want to delete the orig dir.
# rm -r $1
# end

It will move an entire directory including sub-dirs to the destination
directory. Invoke like: mvdir flibit /usr/test
will move the dir flibit to /usr/test/flibit

Not so hard is it?

-- 
John Sparks   |  {rutgers|uunet}!ukma!corpane!sparks  | D.I.S.K. 24hrs 1200bps
______________|          sparks@corpane.UUCP          | 502/968-5401 thru -5406
 
History books which contain no lies are extremely dull.