"Tony Lewis" <[EMAIL PROTECTED]> writes: > Hrvoje Niksic wrote: >> > And how is .tar.gz renamed? .tar-1.gz? >> Ouch. > > OK. I'm responding to the chain and not Hrvoje's expression of pain. :-) > > What if we changed the semantics of --no-clobber so the user could specify > the behavior? I'm thinking it could accept the following strings: > - after: append a number after the file name (current behavior) > - before: insert a number before the suffix
But see Andreas's post quoted above: the term "suffix" is ambiguous. In foo.tar.gz, what is the suffix? How about .emacs.el? And Heroes.S203.DivX.avi? Currently implemented name mangling is far from perfect, but it's easy to understand, to recognize, and to reverse. One other possibility that offers the same features would be to put the number before the file, such as "1.foo.html" instead of "foo.html.1"; but that seems hardly an improvement. > - new: change name of new file (current behavior) > - old: change name of old file It would be nice to be able to change the name of the old file, but when you start to consider the consequences, it gets trickier. What do you do when you have many files left over from previous runs, such as foo, foo.1, foo.2, etc.? Handling it correctly would trigger a flurry of renames, which would need to be carried out in the correct order, be prepared to handle a rename failing, and to detect changed conditions in mid-run. In general it seems like bad design to need to touch many files in order to simply download one. Maybe the improved end user experience makes it worth it, but at this point I'm not convinced of it. > Back to the painful point at the start of this note, I think we > treat ".tar.gz" as a suffix and if --no-clobber=before is specified, > the file name becomes ".1.tar.gz". But see my other examples above.