I am trying to change the ownership of the list of directory such that
chown -LR deep:deep deep/list/of/50/subdirectories
chown -LR deep:deep deeps/list/of/50/subdirectories
But I am getting error for more than 10 sub directories. I thought of writing a perl script such that it is in the same folder as the deep and deeps level. I got to learn about File::path module in perl. But there are only make and rmtree functions in to. Please can somebody help regarding this problem. Thanks.
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:
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>
:although individual filesystems may override this.