I had to copy large directory from one Linux server to windows host via SFTP proto (with WinSCP). However some of directories to be copied lacked executable flag, thus WinSCP failed to list and copy them.
Therefore I needed way to set recursively, all sub-directories under directory /mirror (located on Linux server) to +x executable flag.
There are two ways to do that one is directly through find cmd, second by using find with xargs
Here is how to do it with find:
# find /mirror -type d -exec chmod 755 {} +
Same done with find + xargs:
# find /path/to/base/dir -type d -print0 | xargs -0 chmod 755
To change permissions only to all files under /mirror server directory with find
# find /path/to/base/dir -type f -exec chmod 644 {} +
Same done with find + xargs:
# find /path/to/base/dir -type f -print0 | xargs -0 chmod 644
More helpful Articles
Tags: change permissions, chmod 755, copy, directory permissions, exec, flag, Linux, mirror, proto, recursively, second, server directory, shell script, tiny shell, two ways, winscp, xargs