Collect maps

Hi, my friends. I'm going to write a script to collect and select model maps, but I have a problem.

When the selected model has different paths but the same map name, Max will keep only one map with the same map.

When collecting and selecting models, I want to ask Max to get whether there is a duplicate name map. If so, it will automatically rename the duplicate name map. However, I don't know how to judge whether there is a map file and rename it.

Do you have any friends who would like to help me? thank you.

This is my code

-- Map path
C_Map = @"C:\1\"
-- create folder
makedir C_Map

for M_Map in selection do
(
Everything = usedMaps M_Map
for Map_Sel in Everything do
(
copyFile Map_Sel( C_Map + (filenameFromPath Map_Sel))
)
)