create batch file to copy folder contents with dynamic name

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 04:21:17
LoganMurphy

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

Here is a code for the movement of the file!

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)"
@ECHO OFF
FOR /F "TOKENS=*" %%A IN ('DIR "C:\Example" /s /b /a:d') DO SET CurrentDir=%%A
@ECHO.%CurrentDir%

Replace "C:\Example" with the Path your Folders are in, save it to a File (.bat/.cmd) and execute.

The last step - Echo will return the most bottom foldername.

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