Bu kodu html olarak kaydet Görsellerin olduğu klasöre at ve çalıştır Görsellerin linkini içeren CSV dosyası verecek: ( Soruyu doğru anlamışsam )


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSV Görsel Linkleri Oluştur</title>
</head>
<body>
<h1>Görsel Linkleri CSV Oluşturucu</h1>
<input type="file" id="fileInput" webkitdirectory directory multiple>
<button id="generateCsv">CSV Oluştur</button>

<script>
document.getElementById("generateCsv").addEventLis tener("click", function () {
const input = document.getElementById("fileInput");
const files = input.files;

if (!files.length) {
alert("Lütfen bir klasör seçin.");
return;
}

const baseUrl = "https://barisdogansutcu.com/product_images/";
const validExtensions = [".jpg", ".jpeg", ".png", ".gif", ".webp"];
let csvContent = "Görsel URL\n";

// Dosyaları tarama ve uygun olanları CSV formatına çevirme
for (const file of files) {
const fileName = file.name;
const fileExtension = fileName.substring(fileName.lastIndexOf(".")).toLo werCase();

if (validExtensions.includes(fileExtension)) {
csvContent += baseUrl + fileName + "\n";
}
}

// CSV dosyasını indirme
const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "gorsel_linkleri.csv";
link.style.display = "none";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});
</script>
</body>
</html>


Powered By : ChatGpt