Grammalecte  Check-in [9b3cc7f615]

Overview
Comment:[build] test if folders exist before moving content
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | build
Files: files | file ages | folders
SHA3-256: 9b3cc7f6159e42538c8a89ba6ceb1e7a16924d9d0aed4e3a1cc9ccad70e0bfa1
User & Date: olr on 2020-04-05 10:00:56
Other Links: manifest | tags
Context
2020-04-05
10:37
[build] handle errors in helpers check-in: 583ae99a7b user: olr tags: build, trunk
10:00
[build] test if folders exist before moving content check-in: 9b3cc7f615 user: olr tags: build, trunk
09:54
[fr] ajustements check-in: 52430380b1 user: olr tags: fr, trunk
Changes

Modified helpers.py from [871d0d4238] to [d28c812f24].

    72     72           else:
    73     73               raise
    74     74   
    75     75   
    76     76   def moveFolderContent (spSrc, spDst, sPrefix="", bLog=False):
    77     77       "move folder content from <spSrc> to <spDst>: if files already exist in <spDst>, they are replaced. (not recursive)"
    78     78       try:
           79  +        if not os.path.isdir(spSrc):
           80  +            print("Folder <"+spSrc+"> not found. Can’t move files.")
           81  +            return
           82  +        if not os.path.isdir(spDst)
           83  +            print("Folder <"+spDst+"> not found. Can’t move files.")
           84  +            return
    79     85           for sf in os.listdir(spSrc):
    80     86               spfSrc = os.path.join(spSrc, sf)
    81     87               if os.path.isfile(spfSrc):
    82     88                   spfDst = os.path.join(spDst, sPrefix + sf)
    83     89                   shutil.move(spfSrc, spfDst)
    84     90                   if bLog:
    85     91                       print("file <" + spfSrc + "> moved to <"+spfDst+">")