#include #include $I=2 While 1 ; Read record from file $Path=FileReadLine("z:\Pleadings_Capture\lfn.csv",$I) ; Check for EOF If @Error=-1 Then ExitLoop EndIf ; Variable for file extension $Extension="" ; New path for record just read to strip off the ;999;ok (7 positions) path and filename placed at eor by path scanner software (999 variable representing lengh) $Path=StringMid($Path,1,StringLen($Path)-7) ; Path length $PathLength=StringLen($Path) ; Locate start of last directory and if a file extension exist $LocofSlash=StringInStr($Path,"\",0,-1) $NewPath=StringMid($Path,1,$LocofSlash) $LocofPeriod=StringInStr($Path,".",0,1,$LocofSlash+1) ; Save extension if it exists and get file name minus extension If $LocofPeriod>0 Then $Extension=StringMid($Path,$LocofPeriod) $FileName=StringMid($Path,$LocofSlash+1,$PathLength-$LocofSlash-4) Else $FileName=StringMid($Path,$LocofSlash+1,$PathLength-$LocofSlash) EndIf ; Get length of file name to determine how must to truncate from file name to reduce to 260 total length $FileNameLength=StringLen($FileName) $Strip=$PathLength-260 If $Strip=$FileNameLength or $Strip>$FileNameLength Then MsgBox(0,"",$Path & " cannot be shortened.") ExitLoop Else $FileName=StringMid($FileName,1,$FileNameLength-$Strip) EndIf $FileNameLength=StringLen($FileName) $NewFileName="" For $J=1 To Random($FileNameLength,$FileNameLength,1) ; Return an integer to determine the length of the string. $NewFileName&=Chr(Random(48,122,1)) ; Return an integer between 48 and 122 which represent the ASCII characters between a 0 to Z (upper-case). Next ; Replace characters not allowed in Windows path/file name $NewFileName=StringReplace($NewFileName,":","0") $NewFileName=StringReplace($NewFileName,"<","1") $NewFileName=StringReplace($NewFileName,">","2") $NewFileName=StringReplace($NewFileName,"?","3") $NewFileName=StringReplace($NewFileName,"\","4") $NewFileName=$NewFileName & $Extension $NewPath=$NewPath & $NewFileName $Path="\\?\" & $Path $Return=FileMove($Path,$NewPath) msgbox(0,"",$path & @crlf & @crlf & $newpath & ':' & Stringlen($newpath) & ':' & $return) $I=$I+1 WEnd