This answer is based on Python so it should work on OSX as well as on Windows, assuming you install Python (and for the record, is from the top of my head).
import os
import shutil
path = "C:/dir" # the directory tree you want to "explode"
store= "C:/store" # where all files will be stored
for dirpath, dirnames, filenames in os.walk(path):
name = ""
for c in dirpath:
if c != "/": # if the character is different than the current directory character
name += s
else:
name += "_" # "quick and dirty" way of resolving name conflicts
for files in filenames:
orig_loc = os.path.join(dirpath,files)
copy_loc = os.path.join(store,name + "_" + files)
shutil.copy2(orig_loc,copy_loc)
This should copy all files (plus metadata) from the path structure to the store folder.
If you don't care about name conflicts, don't use the code between the name = "" and the for files in filenames statements. What that code does is to convert / to _ and afterwards prepend that cleared directory name to the files' names.
This will retain the original structure, that you can delete afterwards with shutil.rmtree(path)