copy, overwriting or not

Copy without being asked each time, or without ever replacing a file that is there.

  • files

Steps

  1. alias cp

    see whether cp is an alias for cp -i, which asks

  2. \cp -f src dest

    copy without the alias, replacing dest

  3. cp -n src dest

    never replace a file that is there

  4. cp -i src dest

    ask before replacing

  5. rsync -a --ignore-existing src/ dest/

    copy a folder, only the files dest does not have

  6. cp -u src dest

    replace only when src is newer (GNU)

Commands used

  • cp
  • rsync
  • alias

Each has a page in lore: lore cp opens it.