Hi Paulo,
you can try to clear the dm_media & dm_media_folder tables (make sure you disable foreign key checks) and run dm:setup again. This might take a long time on large media collections though.. make sure you have enough memory available when running this.
I always make sure that the columns in those tables containing path names are using a charset like utf8_bin.
On *Nix systems filenames are case sensitive and using a *_ci (case insensitive) charset will clash as logo.png and Logo.png will be considered the same entry in the database while being 2 different files on filesystem. The same applies for folder names in dm_media_folder..
Hope this gets you going ;-)
Kind regards,
Erik aka 4levels