0

I am trying to building a folder (name:components) within a build folder which contains only html files from the existing component folder using the following code.

find components -iname "*.html" -exec rsync -R {} ./build/ ';'

Building component folder

And it's running perfectly the component is building within build folder but when i access the component folder I'll get following error.

Error Occurring

I'm looking for the permanent solution so that i wouldn't have to give the permission again and again to the folder for accessing.

What i can add into the given code so that automatically authentication give to the folder.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227

1 Answers1

0

There are many rsync options whose purpose is to preserve attributes of copied files/dirs. Assuming that your source files have the permissions you want use the flag for preserving permissions: --perms (or -p).

If the source files don't have the permissions you need then you can use the --chmod flag to set permissions of the target files/dirs to whatever you want. For this to work you also need to specify --perms. The chmod flag takes arguments similar to the chmod(1) command but extends them so you can specify permissions only for directories or only for files. For example this would give write permission to the owner for files only: rsync --perms --chmod Fu+w. It looks like you may not have execute permissions on your directories (at the least) so you could try --chmod D+x for starters.

(I'm assuming that the owner is properly set for your copied files. If not then there is also a --chown=USER:GROUP flag available.)

Note: I'm working with the limited amount of information you've supplied. If you aren't able to figure things out from the above then please run ls -la against one of the target directories and post the result in your question.

B Layer
  • 5,107
  • 1
  • 17
  • 34