diff options
| author | 冯昶 <fengchang@novel-supertv.com> | 2023-02-13 17:22:18 +0800 |
|---|---|---|
| committer | 冯昶 <fengchang@novel-supertv.com> | 2023-02-13 17:22:18 +0800 |
| commit | 245a9bb01d688eac1ecefefb51300ffd9642df1a (patch) | |
| tree | 4c51c5419246b6ca893267e879e942953cea057a /challenge-203/eric-cheung/python/ch-2.py | |
| parent | 1d7da338f23a3842739e903bfd4e06a04f341c11 (diff) | |
| parent | bb462577d3227fa25ed53ee261528d6543a8aad0 (diff) | |
| download | perlweeklychallenge-club-245a9bb01d688eac1ecefefb51300ffd9642df1a.tar.gz perlweeklychallenge-club-245a9bb01d688eac1ecefefb51300ffd9642df1a.tar.bz2 perlweeklychallenge-club-245a9bb01d688eac1ecefefb51300ffd9642df1a.zip | |
Merge remote-tracking branch 'upstream/master'
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)
|
