Svetlitski / fcp

A significantly faster alternative to the classic Unix cp(1) command, copying large files and directories in a fraction of the time.
BSD 3-Clause "New" or "Revised" License
734 stars 17 forks source link

Add `no_clobber` option #38

Open dwisiswant0 opened 1 year ago

dwisiswant0 commented 1 year ago

This commit adds a new boolean parameter no_clobber (https://github.com/Svetlitski/fcp/issues/31#issuecomment-1053722797) to the copy_file and copy_into functions in order to provide an option to skip copying files that already exist in the destination directory. If no_clobber is true and the destination file already exists, an error message is printed and the file is skipped.

The copy_directory and copy_single functions were updated to pass the no_clobber parameter to copy_file and copy_into respectively.

This change makes the copying process more efficient by avoiding unnecessary copies and also prevents accidental overwriting of existing files.