Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-22-2015, 03:35 AM   #1
Registered: May 2013
Posts: 189

Rep: Reputation: 1
rsync - not able to add suffix in copied files

I want to add suffix in all copied file but not able to do with rsync.
Can you please help?
I am trying following commands.
rsync -avz --backup --backup-dir=/root/Documents --suffix=`date +"F"` /var/log/audit /root/Documents
Old 06-22-2015, 05:07 AM   #2
LQ Guru
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,797

Rep: Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888
probably date +%F will work (% was missing ?) (or it was the LQ engine who removed it?)
Old 06-22-2015, 05:48 AM   #3
Registered: May 2013
Posts: 189

Original Poster
Rep: Reputation: 1
No, not working.
The files are being copied at destination still without suffix.

Suppose I want to copy directory /tmp/user
the content of /tmp/user is

Now I want they should be copied as

but not using for loop and cp command.
Can't it be done by rsync?
Please help
Old 06-22-2015, 03:18 PM   #4
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 362

Rep: Reputation: 157Reputation: 157
Make sure you understand how the rsync --backup option works. It makes a backup copy only if the file has changed, and then it performs the specified backup action (--backup-dir=DIR or --suffix) on the older files.

$ ls temp
a  b  c
$ rsync -a --backup --suffix=".old" temp/ temp2/    # first time rsync
$ ls temp2
a  b  c
$ rsync -a --backup --suffix=".old" temp/ temp2/    # second time rsync
$ ls temp2                                          # nothing changed
a  b  c
$ touch temp/a                                      # change 2 files
$ touch temp/b                                      # ...
$ rsync -a --backup --suffix=".old" temp/ temp2/    # third time rsync
$ ls temp2                                          # see suffix appended
a  a.old  b  b.old  c
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync syntax - how to add suffix to files to prevent overwriting? Bloodrule Debian 4 10-06-2014 11:30 AM
rsync - How to skip files that are allready copied? miros84 Linux - Software 8 01-16-2013 04:47 AM
checking for suffix of object files... configure: error: cannot compute suffix of obj megras Linux - Kernel 1 10-15-2012 08:21 AM
cannot compute suffix of object files rocket42 Linux - Embedded & Single-board computer 3 04-06-2012 03:20 PM
What parameter do I add to RSYNC to update modified or new files to the destination? tankman1989 Linux - Software 2 02-20-2010 07:20 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:11 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration