批量将100个文件夹中的所有文件移动到一个文件夹中 [英] batch Moving all files in 100s of folders up one folder

查看:287
本文介绍了批量将100个文件夹中的所有文件移动到一个文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小问题。我不是超级流利的批处理脚本,但我想变得更好。
我试图让我的工作,我们可以用来将父目录的最后一个子目录中的所有文件移动到一个目录的脚本工作。



需要将用多余的子目录传送的图像序列移动到效果工作流的一个子目录

本质上,我正在传送100个图像序列作为:

Episode / Footage / shot / resolution / shot.0000001.dpx



脚本我可以移动到视频文件夹,将解析他们下面的镜头目录,并将图像序列从解决方案文件夹中移出,并将它们直接放置在镜头文件夹中,所以结构看起来更像这样:



Episode / Footage / shot / shot.0000001.dpx

这个批次需要在很多情况下重复使用,不管图像序列的扩展名是什么或者子文件夹的命名结构如何都足以重复使用。

解决方案

  for / fdelims ==%%我在('dir / a:d / b)为/ fdelims ==%% f in('dir %% i / a:d / b')do(move%% i\ %% f\ *%% i&& rd%% i \ %% f/ s / q)





可以用*替换。 *(没有空格)只抓取文件。

在命令行中使用%而不是%%
这将从镜头下的任何目录中抓取。删除第一个for循环,并用shot替换%% i的所有生物,只从那里抓取。


I have a small issue. I'm not super fluent in batch scripting but i'm trying to get better. I'm trying to get a script working at my current job that we can use to move all files in the last sub-directory of a parent up one directory.

The need is for moving image sequences delivered with a superfluous sub-directory up one sub-directory for effects workflow

essentially i'm being delivered 100s of image sequences as:

Episode/Footage/shot/resolution/shot.0000001.dpx

I would love a batch script i could move into the "Footage" folder that would parse the shot directories below them and move the image sequences out of the resolution folder and place them directly into the shot folder so the structure would look more like this:

Episode/Footage/shot/shot.0000001.dpx

This batch would need to be reused over many instances and just be robust enough to be reusable regardless of what the extensions on the image sequences are or the naming structure of the subfolders are.

解决方案

for /f "delims==" %%i in ('dir /a:d /b') do for /f "delims==" %%f in ('dir %%i /a:d /b') do (move "%%i\%%f\*" "%%i"&&rd "%%i\%%f" /s /q)


the * can be replaced with * . * (no spaces) to only grab files.
use % instead of %% for use on the command line
this will grab from any dir under Footage. delete the first for loop and replace all occuences of %%i with shot to only grab from there.

这篇关于批量将100个文件夹中的所有文件移动到一个文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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