Here's a version that will work if a directory has double spaces, as long as that dir isn't passed directly to /rename.doubles. For example, this:
Code:
/rename.doubles "C:\a      b\" *
won't work, but this:
Code:
//rename.doubles $+(",$shortfn($$sdir(C:,Select a folder with double spaces)),") *
should work fine. It will also work if one of the subfolders of the specified folder has double spaces.
Code:
alias rename.doubles {
  tokenize 34 $1-
  return $findfile($1,$mid($2,2),0,temp $1).shortfn
}
alias -l temp {
  var %a = $+(",$nofile($1),$nopath($longfn($1)),")
  if $str($chr(32),2) isin %a && !$isfile($gettok(%a,1-,32)) { .rename $1 %a }
}
cerberus_gr: check this post, it might be of interest.