[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature request: no overwrite on cp, mv (updated)
From: |
Bob Proulx |
Subject: |
Re: feature request: no overwrite on cp, mv (updated) |
Date: |
Sun, 8 Apr 2007 09:13:10 -0600 |
User-agent: |
Mutt/1.5.9i |
Mark Rose wrote:
> I'd like a new, relatively easy to implement feature in cp and
> mv. Currently, the --interactive option prompts before overwriting
> an existing file. There is also --update, that will only overwrite
> if the source file is newer. However, there is not an option to
> noninteractive _not_ overwrite older existing files.
I think your best option is to use 'rsync --ignore-existing'. That
already does what you want.
> I have a directory into which new files are continually being saved,
> and from which files older than a year are being moved. When old
> files have been moved out, users may save new files with the same
> name as archived files.
You did not say if this is an archive, backup, rm alias, or what but
as I read that if a file is updated more often than once a year no
copy is saved? That seems strange to me.
> Currently, I use find to find the files, then call a shell script to
> check if the file already exists, and if not, then move the file.
Seems like a reasonable solution to me.
> This option would also be very handy when merging directory contents without
> overwriting existing files.
See 'rsync' for this and many other features.
> This concept is actually currently implemented, with a combination of -i
> and --reply=no, but the --reply option is slated to be removed soon.
Because the --reply option only specified how to answer the prompt
when a prompt was given, and a prompt was never given if run
non-interactively, this implies to me that you have an interactive
command in your case. But if you ran the command non-interactively
you would find that it did not actually do what you wanted.
Bob