Nov-29-2023, 11:15 AM
(This post was last modified: Nov-29-2023, 11:15 AM by Gribouillis.)
(Nov-29-2023, 09:48 AM)yan Wrote: I would like to make a script to copy an entire tree for testing (folder, sub-folders, files).This is somewhat contradictory, but you could perhaps try the following
I need all but the files are too big in the source and I don't need what's in them.
from pathlib import Path def my_copy(src, dst): # create an empty file instead of actually copying a file Path(dst).touch() # Source src = '/mysourcepath' # Destination dest = '/mydestinationpath' shutil.copytree(src, dest, dirs_exist_ok=True, copy_function=my_copy)
« We can solve any problem by introducing an extra level of indirection »