Quoting Wilko Fokken (wfok...@web.de): > On Thu, Jul 16, 2015 at 08:23:13AM -0400, Haines Brown wrote: > > Sorry for this elementary question. I want to do sequential copies with > > a command like this: $ cp --backup=t file .../destination/file. When > > periodically run it produces file, file.~1~, file.~2~, etc. > > > > How do I get rid of the "~" so that the backups are file.1, file.2, > > etc.? > > If you are familiar with shell scripts, you can use a 'for' loop: > ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ > for i in 1 2 3 ; do > mv file.~${i}~ file.${i} > done > ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ > > You don't have to put each number into the 'for' loop yourself; > with e.g. 17 files, you can write: > > for i in `seq 1 17`; do > ... > done
But, being familiar with shell scripts, if you write this as a script, you now have an arbitrary limit on the number of backups it'll work for, and you need a different version for each backup's base filename. (And note that you need to protect any previous files with mv -i.) A prename command can get all this right if you don't let Perl's syntax scare you off. Cheers, David. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150718164837.GC8297@alum