创建批处理文件以使用动态名称复制文件夹内容 [英] create batch file to copy folder contents with dynamic name

查看:105
本文介绍了创建批处理文件以使用动态名称复制文件夹内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于任何类型的开发,我都是绝对全新的,但是需要批处理作业才能将文件从一个文件夹复制到另一个文件夹. 问题在于源文件夹是动态命名的.文件夹名称将包含当前日期和后缀号(例如"TestRun_20141106_13")-因此,在运行批处理/复制作业之前,我将永远无法确定文件夹的最新"版本.

I am absolutely brand new to any kind of development but need a batch job to copy a file from one folder to another. The problem is that the source folder is dynamically named. The folder name will contain the current date and a suffix number (eg. "TestRun_20141106_13") - so I will never be able to determine the 'latest' version of the folder before running the batch / copy job.

任何人都可以帮忙吗?我知道这对某人来说很容易,但是正如我所说,我是一个完全菜鸟!

Can anyone help please? I know this will be easy for someone but as I said, I am a complete noob!!

先谢谢了. 杰米

推荐答案

是的,我也没有做.bat这么长时间,但是我想我可以帮忙!

Yes, I havent been doing .bat for that long either, but i think i can help!

这是文件移动的代码!

处理动态命名的文件夹...

Dealing wiwth dynamically named folder...

@echo off 
set /p txtfile=Filename without Path assumes c:\: 
echo.%txtfile% 
copy %txtfile% z:\testing\dealer.txt 
echo Come back to this window when Agent is done with process. The copy file will be deleted. 
@pause 
copy %txtfile% c:\somefolder\namedsuccess\%txtfile% 
del z:\testing\dealer.txt 
exit 

我的朋友,您将不得不在其中放置自己的变量!

You will have to place your own variables in there my friend!

用于移动文件! 简单的部分!

For moving of the files! Easy part!

move /-y "Folder Path that files are in*(Any specific keyword?)*" "(Dest. folder)"

这篇关于创建批处理文件以使用动态名称复制文件夹内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆