I have file list which sorting by file length, and progress files. The question is when progress takes a long time, some files in the list may be deleted, moved or can be changed, and I get the error
how can ı use order by and if file.exist() [check file is still there] method for this or any kind of solution?
var sort = from fn in filelist
orderby new FileInfo(fn).Length ascending
select fn;
foreach(string n in sort)
{
//progress
}
Thanks
filelist has file's address
Use File.Exists method this way :
var sort = from fn in filelist
where File.Exists(fn)
orderby new FileInfo(fn).Length ascending
select fn;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.