Hi, today I want to post a small script to copy files and directories and add a specific owner to a folder. I did this script myself and I am fairly new to python, about 6 months of experience. If you think it should be changed or has issues, please let me know so I can improve it.
To achieve my objective I have used a few standard libraries that come already with any major python distribution (`os`, `shutil`, `pwd`, `grp`; I will talk about those in a bit more details afterwards). Then I created a function `copy_files`. This function can receive the source files path, the destination, owner and space, this parameters are used to copy the files set owner and show the results. In this function I use recursion as this is a classic recursion problem, I will come back to this further on this post. The last part of the script checks is the destination exists actually calls copy_files function. This is the code: Continue reading