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
(objTble_Documents); - service.AddScanDocuments();
- }
- }


Manas MohapatraRank #182 · 13.2K reputationPosted Oct 4, 2016, 11:27 PM EDT
Delpin Susai RajRank #53 · 29.5K reputationPosted Oct 4, 2016, 6:48 PM EDT
Delpin Susai RajRank #53 · 29.5K reputationPosted Oct 4, 2016, 6:48 PM EDT
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Oct 5, 2016, 5:28 AM EDT
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Oct 4, 2016, 6:46 PM EDT
Abhilash J ARank #1,243 · 1.4K reputationPosted Oct 4, 2016, 8:54 PM EDT