C# でファイルの名前を変更する:
File.Move(source,Destination);
File.Delete(source);
正常に実行されますが、ファイルの名前を再度変更しようとすると、システムは次の例外を返し ます。別のプロセスで使用されているため、プロセスはファイルにアクセスできません。 これがどこで使用されているのかわかりませんか?エラーをさらにデバッグすると、クラス名が IIS である w3wp.exe のプロセスにあることがわかります。次に何をすればいいですか?取得
foreach (string folder in folder)
{
FileSystemItem item = new FileSystemItem();
DirectoryInfo di = new DirectoryInfo(folder);
item.Name = di.Name;
item.FullName = di.FullName;
item.Path = path + "\\" + item.Name;
item.CreatedDate = di.CreationTime;
item.IsFolder = true;
item.Extension = "folder";
listFolder.Add(item);
}
docList = CreatXmllist(listFolder);
return docList
これは、フォルダーリストを取得する方法であり、xml に返されます。次に、フォルダーで、クリックするとファイルを取得します
今、画像を取得します: これはコードです
public xml (string path, List<l> one)
{
List<T> tt = new List<T>();
List<T> SessionList = new List<T>();
string[] files = Directory.GetFiles(HttpContext.Current.Request.PhysicalApplicationPath + path);
foreach (string file in files)
{
FileSystemItem item = new FileSystemItem();
FileInfo i = new FileInfo(file);
string a = i.LastWriteTime.ToString();
var thumbnails = from a in b where a.Name == fi.Name select t;
if (fi.Name != "a")
if (t.Count() == 0)
{
r session r = new r();
r.aName = fi.aName;
SessionList.Add(r);
fi.Exists;
}
else
t.Add((T)t.First());
}