Page 1 of 1

Find duplicate files (RexEx) windows

Posted: Thu Apr 18, 2013 2:55 pm
by Zebuddi123
Hi to All If you find you have duplicate copies of files (windows) with "(1)".zip etc where window appends (*) to the file name. here is a small proc to find them and return a linkedlist with the filename or path&filename

Code: Select all

ProcedureDLL Find_DupFiles(List Source_filelist.s(),rettype.b) ; Source_filelist.s() - Initial filelist  ,  rettype.b - 0=filename, 1= path&filename 
Global NewList dupList.s()
regex.i = CreateRegularExpression(#PB_Any, "\([1-9]+\)")
If CreateRegularExpression(0, "\([1-9]+\)")
	Protected Dim Result$(0),filename.s
		ForEach Source_Filelist.s()
			filename.s=GetFilePart(Source_filelist())
			NbFound.i = ExtractRegularExpression(0 , filename.s , Result$() )
			For k= 0 To NbFound-1
				AddElement(dupList())
				If rettype=0
					dupList()=filename.s
				Else
					dupList()=Source_filelist.s()
				EndIf
			Next
		Next
	EndIf	
EndProcedure


Zebuddi. :)