move_directories_to_other_directories

Fri, 18 Sep 2015 15:13:42 EDT
sl@[REDACTED]

While building notreally.info, I’ve needed to move various directories
up and down in the directory hierarchy. Presently I create a new
directory, dircp the original directory, then remove the original
directory. In some cases (such as deeply nested hierarchies
containing many megabytes or gigbytes of data), this is not a
satisfactory method. How might moving directories into other
directories be accomplished?

discussion:

Aug 20, 2011
#1 tereniao…@[REDACTED]
This is particularly needed with cwfs which will otherwise preserve duplicates of gigabytes of data for all time.
There was a big argument about how to do this a few weeks ago. If I remember right, what came out of it was the news that the hard-storage file servers already have means of moving files via commands to their console. “All” that’s needed is a means for mv to discover the relevant console file and whether source and dest are on the same fs. /sys/src/cmd/ns.c may be interesting.

Aug 21, 2011
Project Member #2 cinap_le…@[REDACTED]
its impossible to figure out the relevant “console” file.

Aug 21, 2011
Project Member #3 cinap_le…@[REDACTED]
the main reason Tmove was abandoned is that changing 9p is almost impossible without
breaking everything. lib9p for example will just assert() if you send it unknown
9P messages (this is fixed in 9front).

Sep 1, 2011
Project Member #4 cinap_le…@[REDACTED]
also, a console file is not really that usefull. only the hostowner
as access to it. its for administrative commands only! i’m not going to
abuse it as a 9p side channel.
i’m going to close this issue as its going nowhere.
i rarely need it. for the worm argument, just dont put random directories
in your worm that you later regret. put them in /tmp or /n/other.

Sep 1, 2011
#5 tereniao…@[REDACTED]
Issue will not go away just because it’s uncomfortable. ;) I would reopen, but I can’t see any evidence of the issue being closed.
I misremembered when I wrote my previous comment, and was also evidently not thinking straight that day. I won’t post my further useless ramblings, I’ll quote Uriel, who posted something to 9front ML I did not understand at the time:
>>> – add Tmove to 9p and fileservers
>
> This is plain gratuitous idiotic protocol breaking, you can do the
> same thing simply by providing an alternative attach name with ctl
> file(s) for fancy things like moving stuff around.
I’m sure it could not be automatically utilised by mv, but I would consider it better than nothing.

Sep 1, 2011
Project Member #7 stanley….@gmail.com
Not being able to reorganize directories without sacrificing significant portions of the worm severely hinders the usefulness of hierarchical directories as an organizing system. The fact is that sometimes circumstances change or knowledge is updated, and the organization of directories needs to be adjusted.

Sep 16, 2011
Project Member #8 cinap_le…@[REDACTED]
there is too mutch talk, too less code.
as a first step i suggest start implementing the move
operation in cwfs so it can be used with a console
command.
just like there is a create command.