批处理 - 基于最后2个字符的文件夹复制 [英] Batch - copy folders based on last 2 characters

查看:108
本文介绍了批处理 - 基于最后2个字符的文件夹复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上搜索,找不到解决办法或者我不能将它们适应我的问题。
我想为一批从TEMP文件夹的子文件夹复制(几千子文件夹)仅如有子文件夹的最后两位为14。


解决方案

 为/ D %% f由于(%temp%\\ * 14)做(
    MDC:\\地方\\ %%〜NXF> NUL 2 - ; NUL
    XCOPY%%〜FFC:\\地方\\ %%〜NXF/ E / Y

I've searched the web and can not find solution or I can not adapt them to my problem. I would like for batch to copy subfolders from folder TEMP (few thousand subfolders) only if last two characters of any subfolder are 14.

解决方案

for /d %%f in ("%temp%\*14") do (
    md "c:\somewhere\%%~nxf" > nul 2>nul 
    xcopy "%%~ff" "c:\somewhere\%%~nxf" /e /y
)

这篇关于批处理 - 基于最后2个字符的文件夹复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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