When you have to deal with names that have to be unique and can conflict together, you can use this module that deals with conflicts by prepending unique numbers in [] brackets to the name.

hscommon.conflict.get_conflicted_name(other_names, name)

Returns name with a [000] number in front of it.

The number between brackets depends on how many conlicted filenames there already are in other_names.


Returns name without [] brackets.

Brackets which, of course, might have been added by func:get_conflicted_name.


Returns whether name is prepended with a bracketed number.

hscommon.conflict.smart_copy(source_path, dest_path)

Copies source_path to dest_path, recursively and with conflict resolution.

hscommon.conflict.smart_move(source_path, dest_path)

Same as smart_copy(), but it moves files instead.