Java文件拷贝代码范例
import java.io.File; import java.util.StringTokenizer; public class CopyFiles extends FileUtil { private static void CopyFiles_Help(final String src, final String dest) { int nIndex = dest.lastIndexOf(File.separator); CreateFolders( dest.substring(0, nIndex) ); CopyFile(src,dest); } public static void main(String[] args) { String[] strs=new String[]{ "target\\config\\comps\\src\\usrUsb2PhdcInit.c", "target\\config\\comps\\src\\usrUsbDebug.c", "target\\config\\comps\\src\\usrUsbInit.c", "target\\config\\comps\\vxWorks\\40usb.cdf", "target\\h\\usb\\usbOsalDebug.h", "target\\h\\usb2\\usb2Phdc.h", "target\\src\\drv\\usb2\\healthcare\\usb2Phdc.c", "target\\src\\drv\\usb2\\healthcare\\Makefile" }; for(int i=0;i<strs.length;i++){ CopyFiles_Help("D:\\wind6921\\vxworks-6.9\\"+strs[i], "D:\\My Documents\\Google Drive\\pmd-medical\\usbhealthcare"+strs[i] ); } } }