From d1cdd6bd2914289bf868f4cdd4c99979d5464a13 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 13 Feb 2023 06:51:38 +0000 Subject: - Added solutions by Mark Anderson. - Added solutions by W. Luis Mochan. - Added solutions by Peter Campbell Smith. - Added solutions by Duncan C. White. - Added solutions by Luca Ferrari. - Added solutions by Dave Jacoby. - Added solutions by David Ferrone. - Added solutions by Thomas Kohler. - Added solutions by Mariano Spadaccini. - Added solutions by Carlos Oliveira. - Added solutions by Roger Bell_West. - Added solutions by Chicagoist. - Added solutions by Robbie Hatley. - Added solutions by Jorg Sommrey. - Added solutions by E. Choroba. - Added solutions by Kjetil Skotheim. - Added solutions by Arne Sommer. - Added solutions by Pip Stuart. - Added solutions by Robert Ransbottom. - Added solutions by Athanasius. - Added solutions by James Smith. - Added solutions by Flavio Poletti. - Added solutions by Cheok-Yin Fung. - Added solutions by Solathian. - Added solutions by Jan Krnavek. - Added solutions by Eric Cheung. - Added solutions by Ulrich Reike. - Added solutions by Robert DiCicco. --- challenge-203/eric-cheung/python/ch-2.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 challenge-203/eric-cheung/python/ch-2.py (limited to 'challenge-203/eric-cheung/python/ch-2.py') 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) -- cgit