The problem as I see it is you may not have anything to "key in to" to know where the "duplicated" part is.
In any case, this thread may be of interest,
viewtopic.php?f=3&t=3898.
---
Suppose, you could...
read each word in the filename into an array
(slide) step through the array, one by one looking a matching word later in the array
then proceeding to see if the next, then next ... words also compare
you could set a minimum number of word matches required & truncate at that point
> PDF for dummies get started by reading this ebook PDF for Dummies is all you need.pdf
if set to 3 matches...
so PDF finds PDF, then for finds for, then dummies finds Dummies
depending on your code, you could then truncate at that point
> PDF for dummies get started by reading this ebook.pdf
or remove the matched segment
> PDF for dummies get started by reading this ebook is all you need.pdf
I'd think you could do something like that with JavaScript renaming.