[英]batch file move .txt to another folder
i want ot create a batch files but i have not much experience in this.. is anyone can help me? 我想创建一个批处理文件,但我对此没有太多经验。有人可以帮助我吗? i want to create a batch file which is the main function is to move some .txt files from a folder (A) to another folder (B)? 我想创建一个批处理文件,其主要功能是将某些.txt文件从一个文件夹(A)移至另一个文件夹(B)?
but those .txt that going move to other file must base by a condition and the condition is when i trigger the batch file i need to know the trigger time or current time and compare the created date and time of .txt file and it must 3 minutes and 3 second ago.. 但是那些要移到其他文件的.txt必须根据条件确定,该条件是我触发批处理文件时,我需要知道触发时间或当前时间,并比较.txt文件的创建日期和时间,并且它必须3分钟和3秒前
base by this condition i only do the cut and paste from folder A to B 根据这种情况,我只能将文件夹A剪切并粘贴到B
is it doable or anyone can provide me a link so i can refer to it.. 是可行的还是任何人都可以给我链接,所以我可以参考它。
thank you very much. 非常感谢你。
Yes this is do able. 是的,这是可行的。 You need to look at robocopy and it's switches, this should see you right. 您需要查看robocopy及其开关,这应该可以正确显示。 Just type robocopy /? 只需键入robocopy /? in cmd and make a note of all the switches you need as there are a lot! 在cmd中记下您需要的所有开关,因为有很多! There will be other ways of doing this with the if statement but I'm not entirely sure about the timestamp issue. 还有其他一些使用if语句执行此操作的方法,但是我不确定时间戳问题。 Maybe something like this: 也许是这样的:
if %Afiletimestamp% < %Bfiletimestamp% xcopy %Afilepath% %Bfilepath% /y 如果%Afiletimestamp%<%Bfiletimestamp%xcopy%Afilepath%%Bfilepath%/ y
I'm not sure how to aquire the first 2 variables though, maybe someone else can add to this? 我不确定如何获取前两个变量,也许其他人可以添加呢?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.