I'm looking to backup a file. If the file exists in backup form, I'm looking to create a new version of that filename so as not to overwrite the previous backup.
I believe:
cp -b ~/.profile ~/
cp --backup ~/.profile ~/
is exactly what I need. However these options aren't available on a mac. Does anyone know if a substitute exists on a mac?
Easiest thing to do is install GNU cp. The easiest way to do that is install Homebrew:
ruby -e \
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install coreutils
Then you can use gcp
instead of cp
whenever you need features not in the BSD cp that's part of OS X, e.g. gcp --backup
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With