@@ -2241,19 +2241,23 @@ def upload_files(self, request, resources, folder, quiet=False, dir_mode='skip')
2241
2241
exitcode = self ._upload_file (file_name , full_path , quiet , request , resources )
2242
2242
if exitcode :
2243
2243
return
2244
- if os .path .isdir (full_path ) and dir_mode == 'zip' :
2245
- temp_dir = tempfile .mkdtemp ()
2246
- try :
2247
- _ , dir_name = os .path .split (full_path )
2248
- archive_path = shutil .make_archive (os .path .join (temp_dir , dir_name ), "zip" ,
2249
- full_path )
2250
- _ , archive_name = os .path .split (archive_path )
2251
- exitcode = self ._upload_file (archive_name , archive_path , quiet , request ,
2252
- resources )
2253
- finally :
2254
- shutil .rmtree (temp_dir )
2255
- if exitcode :
2256
- return
2244
+ elif os .path .isdir (full_path ):
2245
+ if dir_mode == 'zip' :
2246
+ temp_dir = tempfile .mkdtemp ()
2247
+ try :
2248
+ _ , dir_name = os .path .split (full_path )
2249
+ archive_path = shutil .make_archive (os .path .join (temp_dir , dir_name ), "zip" ,
2250
+ full_path )
2251
+ _ , archive_name = os .path .split (archive_path )
2252
+ exitcode = self ._upload_file (archive_name , archive_path , quiet , request ,
2253
+ resources )
2254
+ finally :
2255
+ shutil .rmtree (temp_dir )
2256
+ if exitcode :
2257
+ return
2258
+ elif not quiet :
2259
+ print ("Skipping folder: " + file_name + "; use '--dir-mode zip' to upload "
2260
+ "folders" )
2257
2261
else :
2258
2262
if not quiet :
2259
2263
print ('Skipping: ' + file_name )
0 commit comments