0

I know the rsync tool and I have studied this post, but I cannot do this:

I have ~/Documents/src/ directory which has many sub-directories and files. I need to create ~/Documents/des/ directory which is a mirror of the ~/Documents/src/ with only a list of files in ~/Documents/files.list which contains thousands of lines like:

...
/home/me/Documents/src/geometryloaders/libdefaultgeometryloader.so
/home/me/Documents/src/imageformats/libqgif.so
/home/me/Documents/src/imageformats/libqicns.so
/home/me/Documents/src/QtQuick/PrivateWidgets/libwidgetsplugin.so
/home/me/Documents/src/QtQuick/Templates.2/libqtquicktemplates2plugin.so
/home/me/Documents/src/QtQuick/Window.2/libwindowplugin.so
/home/me/Documents/src/sceneparsers/libassimpsceneimport.so
/home/me/Documents/src/sceneparsers/libgltfsceneexport.so
/home/me/Documents/src/sceneparsers/libgltfsceneimport.so
/home/me/Documents/src/xcbglintegrations/libqxcb-glx-integration.so
/home/me/Documents/src/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qmlc
/home/me/Documents/src/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qmlc
/home/me/Documents/src/QtQuick/Controls/Styles/Desktop/SwitchStyle.qmlc
/home/me/Documents/src/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qmlc
/home/me/Documents/src/QtQuick/Controls/Switch.qmlc
/home/me/Documents/src/QtQuick/Controls/TableViewColumn.qmlc
...

I have tried to run this from within / root:

me@linux:/> rsync --files-from=/home/me/Documents/files.list -avPRdr  /home/me/Documents/src/ /home/me/Documents/des/

But it gives lots of this error:

failed: No such file or directory

I'm struggling with rsync to achieve my goal. Can anybody help?


UPDATE

I change my command to this, and the No such file error is resolved now:

me@linux:/> rsync --files-from=/home/me/Documents/files.list -avPRdr  / /home/me/Documents/des/

But now the problem is all the files inside /home/me/Documents/src/ are copied over. I just need to copy over the files in files.list, how can I do that?

UPDATE

I used only the -a option and now rsync works as expected, i.e. copying over only files inside the files.list:

me@linux:/> rsync --files-from=/home/me/Documents/files.list -a  / /home/me/Documents/des/
  • Destination directory needs to exists for rsync to do its job. So be sure to create /home/me/Documents/des first – shodanshok Dec 15 '18 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.