File Duplication Finder

File Duplication Finder

Scan Results

Click the scan button to find duplicate files based on the configured data.

Configure File Data

Edit the JSON data below to simulate a file system. Duplicates are found based on matching `contentHash`.

No duplicate files found.

'; pdfDownloadContainer.style.display = 'none'; return; } let html = '
'; duplicates.forEach((group, index) => { html += `

Duplicate Set ${index + 1} (${group[0].size})

    ${group.map(file => `
  • ${file.path}
  • `).join('')}
`; }); html += '
'; resultsOutput.innerHTML = html; pdfDownloadContainer.style.display = 'flex'; } // PDF Generation pdfDownloadBtn.addEventListener('click', () => { if (!lastScanResults) { alert("Please run a scan before downloading a report."); return; } const reportContainer = document.createElement('div'); reportContainer.innerHTML = generateReportHTML(lastScanResults); document.body.appendChild(reportContainer); const reportElement = document.getElementById('pdf-report-template'); const { jsPDF } = window.jspdf; html2canvas(reportElement, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const ratio = canvas.width / canvas.height; let finalImgWidth = pdfWidth - 40; let finalImgHeight = finalImgWidth / ratio; if (finalImgHeight > pdfHeight - 40) { finalImgHeight = pdfHeight - 40; finalImgWidth = finalImgHeight * ratio; } const x = (pdfWidth - finalImgWidth) / 2; const y = 20; pdf.addImage(imgData, 'PNG', x, y, finalImgWidth, finalImgHeight); pdf.save('file-duplication-report.pdf'); document.body.removeChild(reportContainer); }); }); function generateReportHTML(duplicates) { let resultsHtml = duplicates.length > 0 ? duplicates.map((group, index) => `

Duplicate Set ${index + 1}

Size: ${group[0].size} | Hash: ${group[0].contentHash}

    ${group.map(file => `
  • ${file.path}
  • `).join('')}
` ).join('') : '

No duplicate files were found during this scan.

'; return `

File Duplication Report

Generated on: ${new Date().toLocaleString()}

${resultsHtml}
`; } // Tab functionality window.changeTab = function(event, tabName) { document.querySelectorAll('.tab').forEach(tab => tab.classList.remove('active')); event.currentTarget.classList.add('active'); document.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active')); document.getElementById(tabName).classList.add('active'); } // Initial Load loadData(); });
Scroll to Top