Python- Copy folders to another location without using disutils
Question: I'm iterating through a directory that contains lots of folders. I want to
copy each one of those folders from `src` to `dest`.

I have tried using `shutil's copytree`, but there is an issue involving
overriding existing folders. I see that the solution is to use disutils, but I
can't download disutils because my work computer prevents installation of new
packages and pip install doesn't appear to be working from work, either.

Is there an alternate solution using default packages?

Here's the code so you can understand what I'm working with:

    
    
    import os
    from os.path import join 
    import shutil
    
    
    def main():
    
        directory = "Daily_Completed_Surveys"
        for root, dirs, files in os.walk(directory):
           for i in dirs:
                if "POP" in i:
                    src = os.path.join(root, i)
                    dest = "C:\ALLPOP"
                    shutil.copytree(src, dest)
    

The Daily_Completed_Surveys folder contains a structure like
/[somedate]/POP[ComputerID][SomeDate]/[zipped files]

I want to get every folder labeled POP and copy them to the destination
directory. (The folders themselves and the data, not just the zipped data) How
do I do this?


Answer: You could just check if the a directory in `src` exists in `dest`, and if it
does, remove it from `dest` using `shutil.rmtree()`, then use
`shutil.copytree()` to copy the directory and its content over.

Also, not being able to use `pip` somewhat sucks. If you have a proxy to the
outside world you can go through that by using

    
    
    pip install --proxy="user:password@server:port" packagename 
    

