Mass Update Broken Links

It seems from your example that the key parts of the URL structure are staying the same.

2016/5/document.pdf

That means you could use a plugin like ‘Better Search Replace’ (https://en-gb.wordpress.org/plugins/better-search-replace/).

Simply choose to replace:

www.example.com/files/ with www.example.com/wp-content/uploads/sites/#/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)