LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-14-2024, 04:52 AM   #1
yoav_by
LQ Newbie
 
Registered: Mar 2005
Posts: 29

Rep: Reputation: 15
rsync assigning new destination file name


Hello,

I need to sync selected source files to a destination but with an option to change the destionation file name. For example, the file /source/somefolder/somefile has to be synced to /dest/otherfolder/otherfile. Also, I would like to do this using --files-from=LISTFILE option. Is that possible? if so, what is the format of LISTFILE?

TIA
 
Old 05-14-2024, 04:58 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,021

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
basically you need to use another dir. see for example here: https://unix.stackexchange.com/quest...e-copied-files
 
1 members found this post helpful.
Old 05-14-2024, 07:43 AM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,828

Rep: Reputation: 1216Reputation: 1216Reputation: 1216Reputation: 1216Reputation: 1216Reputation: 1216Reputation: 1216Reputation: 1216Reputation: 1216
I think rsync can only rename one file.
Perhaps you have a renaming rule?
If not then you can use a shell loop:
Code:
while IFS="|" read -r srcfile dstfile
do
    rsync "$srcfile" "$dstfile"
done << "_EOT_"
/source/somefolder1/somefile1|/dest/otherfolder1/otherfile1
/source/somefolder2/somefile2|/dest/otherfolder2/otherfile2
_EOT_
Instead of the << "here document" you can have a < mapfile
 
Old 05-14-2024, 08:32 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,021

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
much more efficient to put it into another dir on the target host and rename/move all the files at the end with another tool (or a shell script).
 
1 members found this post helpful.
  


Reply

Tags
rsync



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 file to file without specifying the parent folder as a destination? postcd Linux - General 2 11-20-2020 10:15 AM
assigning value with read command vs assigning value with = sign bubai70 Linux - Server 1 12-11-2017 10:47 PM
assign device name to USB key after assigning device name to hard disk. csegau Linux - General 1 01-12-2014 10:03 AM
[SOLVED] match source pattern in destination and substitute in destination usin AWK 123raajesh Linux - Software 7 11-13-2013 04:22 AM
destination unavailable W/ vpn. All other net destination o.k. MikeOfAustin Linux - Networking 1 04-07-2007 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:28 PM.

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