批处理文件将文件从一个目录复制到另一个目录

时间:2022-03-14 06:25:29

I have two code bases of an application. I need to copy all the files in all the directories with .java from the newer code base, to the older (so I can commit it to svn).

我有一个应用程序的两个代码库。我需要将所有目录中的所有文件从较新的代码库中的.java复制到较旧的(因此我可以将其提交给svn)。

How can I write a batch files to do this?

如何编写批处理文件来执行此操作?

3 个解决方案

#1


6  

XCOPY /D ?

XCOPY / D?

xcopy c:\olddir\*.java c:\newdir /D /E /Q /Y

#2


1  

If you've lots of different instances of this problem to solve, I've had some success with Apache Ant for this kind of copy/update/backup kind of thing.

如果你要解决这个问题的很多不同实例,我已经在Apache Ant上取得了一些成功的复制/更新/备份。

There is a bit of a learning curve, though, and it does require you to have a Java runtime environment installed.

但是,有一点学习曲线,它确实需要您安装Java运行时环境。

#3


1  

I like Robocopy ("Robust File Copy"). It is a command-line directory replication command. It was available as part of the Windows Resource Kit, and is introduced as a standard feature of Windows Vista and Windows Server 2008.

我喜欢Robocopy(“健壮的文件复制”)。它是命令行目录复制命令。它作为Windows资源工具包的一部分提供,并作为Windows Vista和Windows Server 2008的标准功能引入。

#1


6  

XCOPY /D ?

XCOPY / D?

xcopy c:\olddir\*.java c:\newdir /D /E /Q /Y

#2


1  

If you've lots of different instances of this problem to solve, I've had some success with Apache Ant for this kind of copy/update/backup kind of thing.

如果你要解决这个问题的很多不同实例,我已经在Apache Ant上取得了一些成功的复制/更新/备份。

There is a bit of a learning curve, though, and it does require you to have a Java runtime environment installed.

但是,有一点学习曲线,它确实需要您安装Java运行时环境。

#3


1  

I like Robocopy ("Robust File Copy"). It is a command-line directory replication command. It was available as part of the Windows Resource Kit, and is introduced as a standard feature of Windows Vista and Windows Server 2008.

我喜欢Robocopy(“健壮的文件复制”)。它是命令行目录复制命令。它作为Windows资源工具包的一部分提供,并作为Windows Vista和Windows Server 2008的标准功能引入。