it sounds like you're running into the fact that Unix has a limit on the length of pathnames. If you're trying to access a deeply nested directory, the pathname will be too long.
You can get around this by cd'ing into each directory a few levels at a time:
( cd deep/list/of; cd some/more/levels; cd and/a/few/more; ...
chown -LR deep:deep subdirectories )
( cd deeps/list/of; cd some/more/levels; cd and/a/few/more; ...
chown -LR deep:deep subdirectories )
The parentheses are so that all the cd
commands take place in a subshell; when it's done, you're returned to the original shell, starting in the same top-level directory, so you can then process the next subdirectory from there.
The default limit on pathname size is in <limits.h>
:
#define PATH_MAX 4096 /* # chars in a path name including nul */
although individual filesystems may override this.