diff options
Diffstat (limited to 'challenge-203/eric-cheung/python/ch-2.py')
| -rwxr-xr-x | challenge-203/eric-cheung/python/ch-2.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-203/eric-cheung/python/ch-2.py b/challenge-203/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..fedcb744a3 --- /dev/null +++ b/challenge-203/eric-cheung/python/ch-2.py @@ -0,0 +1,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)
|
