I have been trying to change the suffix on my backup files using the --suffix
function but I'm not quite sure how to do it. Currently this line of code
find ./$1 -name "IMG_****.JPG" -exec cp --backup=t {} ./$2 \;
searches the first command line argument directory for images in the IMG_****.JPG
format and copies them to the directory entered second, making copies of any files with duplicate names and adding the =t
suffix to the end giving IMG_****.JPG.~1~
etc. Instead of .~1~
I would like to add something like .JPG
, any ideas on how to use the --suffix
to do this?
Read the man page:
The backup suffix is '
~
', unless set with--suffix
orSIMPLE_BACKUP_SUFFIX
.
It should be pretty obvious from this sentence that supplying --suffix
is equivalent to setting SIMPLE_BACKUP_SUFFIX
, which as its name suggests only applies to simple backups (i.e., --backup=simple
or --backup=never
). E.g.,
> touch src dst
> cp --backup=simple --suffix=.bak src dst
> ls src* dst*
dst dst.bak src
However, you are requesting numbered backups through --backup=t
, so the suffixes you will get will always be .~1~
, .~2~
, etc., unaffected by --suffix
.
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