@@ -203,8 +203,10 @@ def main():
203203 file , args .operation , dst_catalogue , dst_file_path
204204 )
205205 imported_files .append (processed_file )
206- logging .info ("Saving catalogue..." )
207- dst_catalogue .save_db ()
206+
207+ if args .operation != Operation .DRY_RUN : # shouldn't save if dry run (data is messed up too)
208+ logging .info ("Saving catalogue..." )
209+ dst_catalogue .save_db ()
208210
209211 logging .info ("Report:" )
210212 logging .info (f"{ len (imported_files )} files imported." )
@@ -231,20 +233,17 @@ def process_file(file, operation, dst_catalogue, dst_file_path):
231233 dst_file_path = dst_catalogue .find_new_path (dst_file_path )
232234
233235 if operation == Operation .DRY_RUN :
236+ print (f"dry-run: { file .path } -> { dst_file_path } " )
234237 file .path = dst_file_path
235- dst_catalogue .add_file (file )
236- if path_available :
237- logging .info (f"dry-run: { file .path } -> { dst_file_path } " )
238- else :
239- logging .warning (f"dry-run: { file .path } -> { dst_file_path } " )
238+ dst_catalogue .add_file (file ) # needed so path_available is more accurate
240239 return None
241240
242241 if operation == Operation .COPY :
243242 new_file = file .clone_file (dst_file_path )
244243 dst_catalogue .add_file (new_file )
245244 return new_file
246245 elif operation == Operation .MOVE :
247- file .move_file (dst_catalogue )
246+ file .move_file (dst_file_path )
248247 dst_catalogue .add_file (file )
249248 return file
250249
0 commit comments