On Tue, Dec 4, 2012 at 11:34 PM, Pádraig Brady <[email protected]> wrote: > On 12/05/2012 01:25 AM, Raphael S Carvalho wrote: >> >> On Tue, Dec 4, 2012 at 11:05 PM, Pádraig Brady <[email protected]> wrote: >>> >>> On 12/05/2012 12:45 AM, Raphael S Carvalho wrote: >>>> >>>> >>>> On Tue, Dec 4, 2012 at 10:22 PM, Pádraig Brady <[email protected]> wrote: >>>>> >>>>> >>>>> On 12/04/2012 05:04 PM, Paweł Lampe wrote: >>>>>> >>>>>> >>>>>> >>>>>> Hi there ! >>>>>> >>>>>> Few minutes ago, my mate asked me 'is there any way to swap two >>>>>> files ?'. I have realized, that the mv has option -S but it's all >>>>>> about >>>>>> suffix. I think, there should be also -s for swapping. It should work >>>>>> like: >>>>>> mv -s a b >>>>>> Effect should be like: >>>>>> a -> tmp >>>>>> b -> a >>>>>> tmp -> b >>>>>> >>>>>> Think about it >>>>> >>>>> >>>>> >>>>> >>>>> A fairly useful feature, but something as noted here >>>>> that might be more suited to a separate script, >>>>> that could be maintained within coreutils under the >>>>> recently mentioned contrib/ directory >>>>> >>>>> http://lists.gnu.org/archive/html/bug-coreutils/2009-02/msg00014.html >>>>> >>>>> thanks, >>>>> Pádraig. >>>>> >>>> >>>> I read this page: >>>> http://lists.gnu.org/archive/html/bug-coreutils/2009-02/msg00014.html >>>> So I would really like to create that program. Is it still even needed? >>> >>> >>> >>> Cool, thanks! >>> >>> I would prototype a script in shell, >>> with possibly some of the same considerations as in this "rewrite" >>> script, >>> http://lists.gnu.org/archive/html/bug-coreutils/2010-03/txtNTX6owUFov.txt >>> >>> thanks, >>> Pádraig. >> >> >> I was thinking about writing such a program using C language, though >> I'm not sure if it would be the best choice. I could search for the >> best data exchange algorithm, so making the program fast and useful. >> I'm not sure if they(maintainers) would accept a new program in the >> core-utils. As I'm seeing, the program would provide a way to exchange >> data between two files, besides changing filenames. Should another >> one(feature) be implemented? >> I also thought about using Python. > > > The idea here is that swapping files would be just a thin > wrapper around the mv or cp or ln utilities which > already do the heavy lifting in C for copying data > around (often using complicated techniques), or > in fact just renaming as appropriate. > > thanks, > Pádraig.
So what do you think? Which language should I use? I'm going to sleep in few minutes, so I would get started tomorrow. As Bernhard Voelker we could create a C program which would use those tools (mv, cp, ln). Anyway, thanks for answering. Raphael S.Carvalho <[email protected]>
