简体   繁体   English

将特定子文件夹中的文件移动到另一个子文件夹

[英]Move files in specific subfolders to another subfolder

I have folder C:\\Folder .我有文件夹C:\\Folder In this folder I have thousands of subfolders.在这个文件夹中,我有数千个子文件夹。 I want to target only those ending in cv .我只想针对那些以cv结尾的人。 In these subfolders I have a file and another subfolder.在这些子文件夹中,我有一个文件和另一个子文件夹。 C:\\Folder\\SubFoldercv\\cv . C:\\Folder\\SubFoldercv\\cv I would like to move all the files in those subfolders to the second subfolder using CMD in Windows 10.我想在 Windows 10 中使用 CMD 将这些子文件夹中的所有文件移动到第二个子文件夹。

(So from C:\\Folder\\SubFoldercv to C:\\Folder\\SubFoldercv\\cv ). (所以从C:\\Folder\\SubFoldercvC:\\Folder\\SubFoldercv\\cv )。

Use for /D to find the directories ending with cv , and use robocopy to copy (or robocopy /mov to move) all files from a folder to another:使用for /D查找以cv结尾的目录,并使用robocopy将所有文件从一个文件夹复制(或robocopy /mov移动)到另一个文件夹:

@echo off
FOR /D %%G IN ("C:\Folder\*cv") DO robocopy /mov "%%~G" "%%~G\cv" "*"

I'm currently not on a windows machine so I'm not able to test it but it should do the trick and move all files to the cv subfolder for all folders ending on cv .我目前不在 Windows 机器上,所以我无法对其进行测试,但它应该可以解决问题,并将所有文件移动到cv子文件夹中以cv结尾的所有文件夹。

If you want to use it on the command-line, use:如果要在命令行上使用它,请使用:

FOR /D %G IN ("*cv") DO robocopy /mov "%~G" "%~G\cv" "*"

instead.反而。

EDIT : After the OP tested it, he has confirmed that it works.编辑:在 OP 对其进行测试后,他已确认它有效。

How to do?怎么做?

subfolderHolder = uploads

FOR /D %%i IN ("%MoveDirSource%\*\%subfolderHolder%\*") DO ROBOCOPY /MOV /E "%%i" "%MoveDirDestination%\%%~nxi"

but the wild card is not working但通配符不起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将特定文件移出子文件夹并删除所述子文件夹 - Move specific files out of subfolders and delete said subfolders 如何将特定文件夹的每个子文件夹中的所有 *.pdf 文件移动到每月创建的子文件夹? - How to move all *.pdf files in each subfolder of a specific folder to a monthly created subfolder? 将文件移动到目标目录的子文件夹中 - Move files into a subfolder of a destination directory 根据子文件夹中的文件类型创建子文件夹,然后移动该类型的所有文件 - Create subfolders based on file types in subfolder and move everything of that type 如何将特定文件从多个子文件夹移动到各自的父文件夹? (Windows批处理) - How can I move specific files from multiple subfolders to their respective parent folder? (Windows batch) 从子文件夹中删除早于特定日期的专门命名的子文件夹 - Delete specifically named subfolder older than a specific date from subfolders 获取特定子文件夹中的文件列表 - get files list in a specific subfolder BAT脚本按文件名将文件移动到子文件夹中 - BAT script to move files into subfolders by file name 将子文件夹中的文件移动到文件夹并重命名Windows提示符 - Move files in subfolders to a folder and rename windows prompt 根据名称批量移动文件到新的子文件夹 - Batch move files to new subfolders based on name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM