asp.net selects the excel type file and copies the file in batches using the Dos command

  • 2020-05-07 19:29:19
  • OfStack

1, select the excel type file
 
OpenFileDialog fileDialog = new OpenFileDialog(); 
// fileDialog.InitialDirectory = "d:\\"; 
fileDialog.Title = " Select the file "; 
//fileDialog.Filter = "xml files (*.xml)|*.xml"; 
fileDialog.Filter = "Excel file |*.xls| All the files |*.*"; 
fileDialog.FilterIndex = 1; 
fileDialog.RestoreDirectory = true; 
if (fileDialog.ShowDialog() == DialogResult.OK) 
{ 
String fileName = fileDialog.FileName; 
//  Use file names  
} 
else 
{ 
//  Operation when no file is selected  
} 

Copy in batches using the Dos command
Function: filename unchanged, suffix changed (from *.bgf to *.xls)
Create file test.bat, content: copy *bgf \new\* xls
new for storing new files and *bgf same directory code: copy *bgf \new\* xls, the next level directory code: copy *bgf new\* xls, no slashes,
(1) operation - cmd-cd f:
(2) cd file name *
(3) execute test.bat

Related articles: