Created
August 2, 2021 09:40
-
-
Save kek-Sec/7400def520e05aed541731e77472310b to your computer and use it in GitHub Desktop.
eretailcontent image script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
List<String> ids = new List<String>(); | |
List<String> imgs = new List<String>(); | |
Console.WriteLine("Dir -> "); | |
var image_folder = Console.ReadLine(); | |
string[] files = Directory.GetFiles(image_folder,"*", SearchOption.AllDirectories); | |
foreach(string s in files) | |
{ | |
var id = s.Split('_')[0]; | |
var exists = false; | |
var indx = 0; | |
foreach(string s2 in ids) | |
{ | |
if(s2 == id) { exists = true; break; } | |
indx++; | |
} | |
if(exists) | |
{ | |
imgs[indx] = imgs[indx] + ";" + s; | |
continue; | |
} | |
else | |
{ | |
ids.Add(id); | |
imgs.Add(s); | |
} | |
} | |
File.WriteAllLines(image_folder + "\\ids.txt", ids.ToArray()); | |
File.WriteAllLines(image_folder + "\\imgs.txt", imgs.ToArray()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment