Hello Everyone,
I am trying to each save filepath and filename from Arralist.
In the 'Images' folder have 3 .jpg file. Like that, 'E:\File\Images\A_001.jpg' , E:\File\Images\A_002.jpg ect. I want to save each filepath and
filename (A_001), here 'A' is parrentName and childName is 001,002 ect. childName want to save under the parrentName. How to save each filepath and filename?
- string[] jpgFilePath = Directory.GetFiles(@"E:\File\Images", "*.jpg").ToArray();
-
- string[] jpgFilesNames = Directory.GetFiles(@"E:\File\Images", "*.jpg")
- .Select(path => Path.GetFileName(path))
- .ToArray();
-
-
- objTble_Documents.CreatedDate = Convert.ToDateTime(DateTime.Now);
- objTble_Documents.IsActive = true;
- objTble_Documents.CreatedBy = 1;
- objTble_Documents.UserId = 1;
- foreach (var item in jpgFilePath)
- {
- foreach (var item1 in jpgFilesNames)
- {
- string parrentName = item1.Split('_')[0];
- string childName = item1.Split('_')[1];
- objTble_Documents.FilePath = item;
- objTble_Documents.Parent_File_Name = parrentName;
- objTble_Documents.Child_File_Name = childName;
- service.ObjDocuments = Mapper.Map<ViewModel.Tble_Documents, Tble_Documents>(objTble_Documents);
- service.AddScanDocuments();
- }
- }