private void CreateDownloadFolders()
{
string locationToCreateFolderRadar = textBoxRadarPath.Text;
string locationToCreateFolderSatellite = textBoxSatellitePath.Text;
string folderName = "";
string date = DateTime.Now.ToString("ddd MM.dd.yyyy");
string time = DateTime.Now.ToString("HH.mm tt");
string format = "{0} On {1} {2}";
folderName = string.Format(format, date, time, "");
Directory.CreateDirectory(locationToCreateFolderRadar + "\\" + folderName);
Directory.CreateDirectory(locationToCreateFolderSatellite + "\\" + folderName);
radarFolderImagesDownload = locationToCreateFolderRadar + "\\" + folderName;
satelliteFolderImagesDownload = locationToCreateFolderSatellite + "\\" + folderName;
folders.Add(radarFolderImagesDownload);
folders.Add(satelliteFolderImagesDownload);
}
The problem is on the line :
folderName = string.Format(format, date, time, "");
When I'm using a breakpoint I see that in the folderName string in the end after the pm there is a space.
I'm not sure how to remove that space and why he is added.
The space in the end give me exception that the directory cannot be found. I think the space in the end is the problem.
In the screenshot image on the left is the folder name string and in the end after the pm there is a space.