Asp.net selects Excel files and uses the DOS command to copy files in batches

Source: Internet
Author: User

1. Select an Excel file
CopyCodeThe Code is as follows: openfiledialog filedialog = new openfiledialog ();
// Filedialog. initialdirectory = "d :\\";
Filedialog. Title = "select file ";
// Filedialog. Filter = "XML files (*. XML) | *. xml ";
Filedialog. Filter = "Excel file | *. xls | all files | *.*";
Filedialog. filterindex = 1;
Filedialog. restoredirectory = true;
If (filedialog. showdialog () = dialogresult. OK)
{
String filename = filedialog. filename;
// Use the file name
}
Else
{
// Operation when no file is selected
}

2. Copy files in batches using the DOS command
Function: the file name remains unchanged, and the suffix is changed (from *. BGF to *. xls)
Create the file test. bat. Content: Copy * BGF \ new \ *. xls
New is the folder for storing new files. The code in the same directory as * BGF is copy * BGF \ new \*. XLS. The code for the next-level directory is copy * BGF new \*. xls, do not slash,
(1) Run-cmd-cd f:
(2) CD file name *
(3) execute test. bat.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.