VBA Excel macro scripting language processing test file copy

2010-11-29  来源:本站原创  分类:Tech  人气:110 

' The specified file directory replication tools  ( Can a user based on the svn version-controlled project to do incremental publishing purpose use  )
' Author  : Xu fruit
' Date  :2010-11-26
Sub copyfiles()
On Error GoTo errorflag
' Specifies the line number of the target file
Dim i As Integer
' Specifies the target file's directory of length variables
Dim j As Integer
' Directory name array, the build target file directory name list
Dim directoryNameArray() As String
' Specifies the target file name part of the file path
Dim relativeFilePath As String
' Temporary directory name
Dim tempDirectoryName As String
For i = 0 To Cells(3, 2) - 1
    tempDirectoryName = ""
    ' Access to the specified destination file path name
    relativeFilePath = Cells(4 + i, 2)
    If relativeFilePath = "" Then
        Exit For
    End If
    relativeFilePath = Replace(relativeFilePath, "/", "\")
    directoryNameArray = Split(relativeFilePath, "\")
    ' If a copy of the target file's path to the directory does not exist, then the establishment of appropriate directory files
    For j = 0 To UBound(directoryNameArray) - 1
        tempDirectoryName = tempDirectoryName & "\" & directoryNameArray(j)
        If Dir(Cells(2, 2) & tempDirectoryName, vbDirectory) = "" Then
           MkDir Cells(2, 2) & tempDirectoryName
        End If
    Next j

    ' Sets the source path and target path
    Dim destinationFileFullPath As String
    Dim sourceFileFullPath As String
    sourceFileFullPath = Cells(1, 2) & tempDirectoryName & "\" & directoryNameArray(j)
    destinationFileFullPath = Cells(2, 2) & tempDirectoryName & "\" & directoryNameArray(j)

    ' Copy the file
    FileCopy sourceFileFullPath, destinationFileFullPath
Next i
MsgBox " The specified file directory replication is complete  "
GoTo finished
Exit Sub
errorflag:
MsgBox sourceFileFullPath & (i + 4)
finished:
End Sub
相关文章
  • VBA Excel macro scripting language processing test file copy 2010-11-29

    ' The specified file directory replication tools ( Can a user based on the svn version-controlled project to do incremental publishing purpose use ) ' Author : Xu fruit ' Date :2010-11-26 Sub copyfiles() On Error GoTo errorflag ' Specifies the line n

  • LUA scripting language entry 2010-03-28

    LUA scripting language entry Preliminary Study Lua Programming: Mu Feng (Second Life members) This article comes from CSDN blog: http://blog.csdn.net/skyremember/archive/2008/10/17/3089447.aspx In this article, I want to tell you how to Lua programmi

  • JDK6 new features: Scripting language support (Scripting) 2010-03-29

    Overview JDK6 increased its support for scripting languages (JSR 223), theory is the scripting language to compile into bytecode, so scripting languages can also enjoy the Java platform, many advantages, including portability, safety, etc. In additio

  • What is a compiled language. Explanatory language and scripting language 2010-03-12

    The computer can not directly understand the high-level language, can only understand machine language directly, it must be high-level language should be translated into machine language, the computer can be value-based high-level language program. T

  • Dedicated to the keen amateur natural language processing classification of Chinese news corpus bis (Reprinted) 2010-10-04

    Original Address: http://www.cnblogs.com/finallyliuyu/archive/2010/09/11/1824091.html Disclaimer: This corpus is for amateurs natural language processing research and communication, banned for any commercial purposes (including advertising and other

  • How to use PHP as a scripting language Shell 2010-12-03

    Many people may have thought about using PHP to write some procedures like regular letters, but no way to time the implementation of PHP; We all know, PHP is a very good dynamic web development languages (speed fast, short development cycle ... ....)

  • C-based scripting language development technology-csp 2011-05-01

    What is eybuild http://www.eybuild.com/develop/index.htm eyBuild, is short for Easy Build, which is the CSP (C Language Service Page) development kit in general. eyBuild WEB applications on embedded devices is the ideal development tool, with a WEB s

  • Beauty of Mathematics Series 3 - Hidden Markov Model in Language Processing 2010-03-26

    Author: Wu Jun, Google Fellow Background: Hidden Markov Model is a mathematical model, to whom now, it has been considered to achieve fast and accurate speech recognition system of the most successful method. Complex problem of speech recognition by

  • Beauty of Mathematics Series 8 - Gulinike stories and modern language processing 2010-03-26

    Posted by: Google researchers, Wu Jun Readers may have noticed, we in the preceding series, the name was mentioned several times Jialinike. In fact, modern speech recognition and natural language processing, and it is indeed a name is closely linked.

  • Beauty of Mathematics Series 15 - Traditional and simple natural language processing of several elite 2010-03-26

    Author: Wu Jun, Google Fellow I am the beauty of the series in mathematics has been a good way to emphasize that simple. But, in fact, natural language processing there are some exceptions, such as a problem of some scholars to the extreme, the persi

  • Beauty of Mathematics Series 20 - Godfather Marcus natural language processing 2010-03-27

    Posted by: Google researchers, Wu Jun We described in the previous series and mentioned some of the promising young scientists, Michael Collins, Eric Blair, David Ya let Wieniawski, Lanapati so, they all came from Pennsylvania Department of Computer

  • JScript.VBScript use the message box. Dialog - scripting language 2010-08-28

    The use of JScript message box ------------------------------------- Use warnings, tips and warnings can be used to confirm, confirm and prompt a message box to get user input. The message box is a window object's interface methods. As the window obj

  • Dedicated to the keen amateur natural language processing corpus of Chinese-language news category (Reprinted) 2010-10-04

    Original Address: http://www.cnblogs.com/finallyliuyu/archive/2010/09/10/1823676.html Inscription: Do research, especially research based on statistical methods often require large amounts of training data. Details of these things is not difficult to

  • Python scripting language is very useful 2010-12-25

    Python scripting language ---------------- very useful Today, do not know which nerve short-circuit, even started to pay attention Python. Internet casually looked down a document, think this thing is too practical it! Might be possible to carefully

  • After the file is corrupted java file copy 2010-03-29

    Today, using java to write a file copy on a small tool for FileUtil.java I used a method: copyFile (File source, File destnation) I found copies of compressed files, exe and other files, the file size of the same, but the compressed file can not be o

  • Java implementation file copy of the 4 methods 2010-04-02

    Reprinted: Original Transfer from http://blog.csdn.net/ta8210/archive/2008/01/30/2073817.aspx File copy using java I believe many people will use, but efficiency is best? Recently looked at the NIO in the end decide what to try java NIO performance i

  • File Operations in C # in the file instance - create a file. Copy the files. Move files (change) 2010-07-06

    Original: http://panjunlai.blog.163.com/blog/static/5819030120104207819450/ First, create a file using System.IO; class Program ( static void Main () ( string filepath = @ "f: \ file.txt"; File.Create (filepath); ) ) We should note that: 1, in t

  • Linux file copy. Delete and move commands 2010-10-17

    Linux file copy, delete and move commands cp command function: copy the given file or directory to another file or directory, just as DOS copy command under the same very powerful. Syntax: cp [options] source file or directory target file or director

  • Linux file copy of the two 2010-10-27

    scp is a secure copy, is used for remote file copy. data transmission using ssh1, and ssh1 and use the same authentication, provide the same security guarantees. The difference is that with rcp, scp will ask you to enter a password if necessary. The

  • Shell remote host file copy 2011-08-02

    #!/bin/sh ################################################################################ ###### Host 10.0.64.224 /data/sea/upload/ Under file copying to 10.10.31.79############# ###### After the file copy is successful, the file from 10.0.64.224 De