How to copy files using a batch file? [duplicate]

怎甘沉沦 提交于 2021-02-04 19:54:30

问题


I need to create a batch file to copy certain files (e.g., 19_1_White.jpg) to a folder within the directory. How can I do this?


回答1:


XCOPY F:\*.* G:\ /C /S /D /Y /I

XCOPY allows for copying of files, directories, and sub directories.
F:\*.* is our source location
G:\ is our destination location
/C tells XCOPY to ignore errors, and finish what can be done
/S tells XCOPY to copy everything including directories and
subdirectories
/D tells XCOPY to only copy source files that are newer than the
destination files (big time saver on the process)
/Y tells XCOPY to overwrite files without asking for confirmation
/I tells XCOPY to automatically create new directories on the
destination, if new directories were created in source.



回答2:


you need to use the command XCOPY eg XCOPY A.jpg C:\Folder\A.jpg

Take a look at https://support.microsoft.com/en-us/help/289483/switches-that-you-can-use-with-xcopy-and-xcopy32-commands for any other switches you may want to use too.



来源:https://stackoverflow.com/questions/8574675/how-to-copy-files-using-a-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!