c# - here my code if to navigate the files and copy if exist the files -
i'm having error please me.
the error:
1 expected catch or finally
the code:
class program { static void main() { string sourcedir = @"c:\source";//folder directory path// try { var txtfiles = directory.enumeratefiles(sourcedir, "*.*", searchoption.alldirectories).where(s => s.endswith(".jpg") || s.endswith(".bmp") || s.endswith(".png") || s.endswith(".gif") || s.endswith("jpeg"));//identify extension name// foreach (string currentfile in txtfiles) { string filename = currentfile.substring(sourcedir.length + 1); directory.getfiles(currentfile, path.getextension(filename)); directory.getfiles(currentfile, path.getfilename(filename)); directory.getfiles(currentfile, path.getfilenamewithoutextension(filename)); } } } } }//get files//
you missing catch{}
block in try-catch.
Comments
Post a Comment