Hi!
If the first part in your path always will be 'http://mysite.com/common/folder/' you can do it like this:
$separator = '/folder/';
$string = 'http://mysite.com/common/folder/unique/folder/file.htm';
$separatorPos = strpos($string, $separator);
$separatorLength = strlen($separator);
$partYourLookingFor = substr($string, $separatorPos + $separatorLength);
Or in short version:
$string = 'http://mysite.com/common/folder/unique/folder/file.htm';
$partYourLookingFor = substr($string, strpos($string, '/folder/') + 8);