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 (ie, --backup=simple
or --backup=never
). Eg,
> 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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.