Avatar of itnifl
itniflFlag for Norway

asked on 

Filename always includes ;1 at the end, why?

I have some C# code that goes something like this:
using DiscUtils;
using DiscUtils.Common;
using DiscUtils.Iso9660;

public void PopulateUSBDrive(string isoSource, string volumeName) {
 using (FileStream isoStream = File.Open(@isoSource, FileMode.Open)) {
	CDReader iso = new CDReader(isoStream, true);
	CopyDirectoryTree(iso.Root, ref iso, volumeName);
	isoStream.Close();
 }
}
/// <summary>
/// Copies all files and folders from iso
/// </summary>
/// <param name="rootDir">Points to the current DiscDirectoryInfo that is the root of file copy operations</param>
/// <param name="iso">The CDReader object that represents the iso we are copying from</param>
/// <param name="destinationVolumeName">The volume name of the USB partion we are copying the iso to</param>
/// <returns></returns>
private List<DiscDirectoryInfo> CopyDirectoryTree(DiscDirectoryInfo rootDir, ref CDReader iso, string destinationVolumeName) {
 UsbDisk installDisk = usbDisks.Where(x => x.Volume == destinationVolumeName).FirstOrDefault<UsbDisk>();
 string installPartitionDriveLetter = installDisk != null ? installDisk.DiskLetter : String.Empty;

 if (!String.IsNullOrEmpty(installPartitionDriveLetter)) {
	string directory = installPartitionDriveLetter + "\\" + rootDir.FullName;
	if (!Directory.Exists(directory)) Directory.CreateDirectory(directory);
	foreach (var file in rootDir.GetFiles()) {
	   Stream fileStream = iso.OpenFile(file.FullName, FileMode.Open, FileAccess.Read);
	   using (FileStream output = new FileStream(installPartitionDriveLetter + (file.FullName.Contains(';') ? file.FullName.Split(';')[0] : file.FullName), FileMode.Create)) {                  
		  fileStream.CopyTo(output);
	   }
	}
	foreach (DiscDirectoryInfo subdir in rootDir.GetDirectories()) {
	   CopyDirectoryTree(subdir, ref iso, destinationVolumeName);
	}
 }        
 return rootDir.GetDirectories().ToList<DiscDirectoryInfo>();
}

Open in new window


file.FullName and file.Name will always end with ;1 for some reason, while the true filename does not end with ;1. To write to the correct file name, I have to split the string that represents the name at ; and take the first part as the valid file name(see line 28). Why does this happen, am I doing something wrong? Any way to avoid this?
C#.NET ProgrammingProgramming

Avatar of undefined
Last Comment
itnifl
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of itnifl
itnifl
Flag of Norway image

ASKER

A guy at work thought it was a version marker used in Linux file systems long time ago. I don't know, but I sure can't see any good use for it.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo