blob: fedcb744a3ddb5c9f96aa89843c26e8e69be9e0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
## Remarks
## https://www.geeksforgeeks.org/python-copy-directory-structure-without-files/
import shutil
import os
## Define the Function to Ignore the Files If Present in Any Folder
def GetIgnoreFiles(strDir, strFiles):
return [strFileLoop for strFileLoop in strFiles if os.path.isfile(os.path.join(strDir, strFileLoop))]
strSourceFolderPath = "/a/b/c"
strTargetFolderPath = "/x/y"
## Calli the shutil.copytree() method and Pass the strSourceFolderPath, strTargetFolderPath and Ignore Parameter
shutil.copytree(strSourceFolderPath, strTargetFolderPath, ignore = GetIgnoreFiles)
|