Using rsync to rename files during copying with --files-from?

6,641

Solution 1

Unfortunately I don't think rsync has any built-in renaming capability. The first workaround that comes to mind is that you could create a local mirror directory, with (renamed) symlinks to the actual data. Then you could use rsync on the mirror directory, adding the -L option ("transform symlink into referent file/dir"). You'd want to write a quick helper script to automate updating the mirrored structure, but it doesn't sound too scary.

Solution 2

If your rename would consist of merely adding a suffix to the existing name, then you might be able to use the --backup and --suffix options to rsync.

Share:
6,641

Related videos on Youtube

Mark Richman
Author by

Mark Richman

https://markrichman.com Mark offers a unique combination of deep technical and business expertise, and a strong track record of success. Mark has built, grown, and driven software engineering teams for organizations of all sizes. Mark has developed courses on a wide range of AWS topics for Linux Academy and Pluralsight. Mark is the coauthor of the 2001 book Professional XML Web Services. He’s a former contributor to XML Journal and Web Services Journal. Mark has been routinely quoted and mentioned in publications like the Palm Beach Post and more. Mark frequently mentors executive leadership in cloud technology concepts and techniques. He is an avid writer and speaker, delivering engaging seminars and webinars on a range of topics. Mark has held key roles in the IT industry, spanning development, project management, product management, and marketing. Mark holds a BS in Computer Science and an MBA with a specialization in Technology Management. Organizations that work with Mark can expect dramatic results such as: Successful migrations of on-premises applications into AWS Significant reduction in existing AWS costs Further cost reduction, faster execution, and risk reduction using infrastructure-as-code Improved cloud security posture with automated incident response procedures Fault-tolerant and highly available infrastructure that scales to meet demand Elimination of undifferentiated heavy lifting, such as application and cloud operations Ability continuously adapt your applications to reduce costs, increase uptimes, respond to business events, and exploit the pace of innovation in AWS. Areas of Expertise Include: Application Architecture Performance Optimization Migrations Security, Governance & Compliance Cloud Operations Cost Savings

Updated on September 18, 2022

Comments

  • Mark Richman
    Mark Richman over 1 year

    Using rsync, how can I rename files when copying with the --files-from argument? I have about 190,000 files, each of which need to be renamed when copying from source to destination. I plan to have the list of files in a text file to pass to the --files-from argument.