根据文件名将文件复制到单个文件夹中 [英] copying files into individual folders based on filename

查看:138
本文介绍了根据文件名将文件复制到单个文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要根据已创建文件夹的文件名将CD中的多个文件复制到单个文件夹中.

I need to copy multiple files from CD into individual folders based off of the filename the folders are already created.

所有文件名都以 s 作为第一个字符.因此,文件名如下所示: s12345.pdf ,需要将其复制到的文件夹称为 12345

All the filenames have an s as the first character. So a filename would look like this: s12345.pdf and the folder it needs to be copied into is called 12345

下一个文件名是 s67890.pdf ,文件夹是 67890

The next filename is s67890.pdf and the folder is 67890

推荐答案

这是一个开始.当我一段时间不使用cmd脚本时,我会变得非常生锈.

Here's a start. I get pretty rusty with cmd scripts when I don't use them for a while.

@echo off
setlocal enabledelayedexpansion
for %%f in (*) do (
    set file=%%f
    echo move !file! !file:~1,5!\
)

这篇关于根据文件名将文件复制到单个文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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