Ticket #2413 (new enhancement)

Opened 12 years ago

Last modified 11 years ago

Support backups in cp/mv operations

Reported by: gotar Owned by:
Priority: major Milestone: Future Releases
Component: mc-core Version: 4.7.4
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:


from man cp/mv:


make a backup of each existing destination file


The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values:

none, off

never make backups (even if --backup is given)

numbered, t

make numbered backups

existing, nil

numbered if numbered backups exist, simple otherwise

simple, never

always make simple backups

As a special case, cp makes a backup of SOURCE when the force and backup options are given and SOURCE and DEST are the same name for an existing, regular file.

This function in missing in mc, which only offers overwrite or skip. I'm using a script with double suffixing:

copy="$orig"-`date +%F`
mv --backup=numbered "$orig" "$copy"

which is even better, as it doesn't create countless numbers of backups (useful for files frequently changed).

Change History

comment:1 Changed 11 years ago by andrew_b

  • Branch state set to no branch
  • Milestone changed from 4.7 to Future Releases
Note: See TracTickets for help on using tickets.