如何使用CMD将所有子目录中所有具有扩展名的文件移动到其父级? [英] How to move all files with specific extension from all subdirectories to their parent using CMD?

查看:217
本文介绍了如何使用CMD将所有子目录中所有具有扩展名的文件移动到其父级?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文件夹 c:\folder1 包含 subfolder1 subfolder2 等。



这些子目录持有 .pdf .db 文件。



如何将所有 .pdf 文件移动到 c:\folder1 使用Windows命令解释器?

解决方案

这对我有用



此命令将从源代码递归复制PDF文件到目标目录
,在Windows 7中使用cmd进行测试,并且/ p>

for / r c:\source_directory\%% x in(* .pdf)do move%% xc:\target_directory\



希望它有助于


Folder c:\folder1 contains subfolder1, subfolder2, etc..

These subdirectories hold .pdf and .db files.

How can all the .pdf files be moved to c:\folder1 using the Windows command interpreter?

解决方案

This worked for me

This command will copy recursively al pdf files from source to target directory using cmd in windows 7 - tested and works

for /r "c:\source_directory\" %%x in (*.pdf) do move "%%x" "c:\target_directory\"

hope it helps

这篇关于如何使用CMD将所有子目录中所有具有扩展名的文件移动到其父级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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