I want to copy a certain file to a specified path. This specified path has many hierarchies of directories which do not exist in advance and need to get created during copying.
I tried shutil.copy*
functions but they all seem to require that the directory at destination path is pre-created.
Is there any functions that sets up these directories as required and copies the file?
Example usage:
copy_file('resources/foo.bar', expanduser('~/a/long/long/path/foo.bar'))