批处理查找文件,复制文件,然后从CSV重命名文件 [英] Batch To Find File, Copy File, then Rename File from a CSV

查看:439
本文介绍了批处理查找文件,复制文件,然后从CSV重命名文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:要获取与列B同名的图片:

Goal: To obtain images with the same name as column B:

我目前将A列中的图像作为JPEGS存储在本地。我也有一个excel文档与需要重命名的文件。我想要:

I currently have the images in column A stored locally as JPEGS. I also have an excel document with the files that need to be renamed. I want to:


  1. 从文件夹复制图片(即BEVBB48GSY1B.jpg)

  2. 重命名文件到行文本中的下一个单元格(即BEV-BB48GSY1B.jpg)

  3. 自动移动到下一行以执行相同的操作(即BEVBB48GSY1B被复制并重命名为BEV-BB48GSY1B27)

我需要使用哪种程式设计或从哪里开始的任何想法?先感谢。

Any ideas on which programming I need to be using or where to start? Thanks in advance.

推荐答案

一个简单的批处理脚本应该可以。

A simple batch script should do.

@echo off

for /F "tokens=1,2 delims=," %%j in (your.csv) do (
    rename "path\to\images\%%j.jpg" %%k.jpg
)

它将打印出CSV的第一行(实际是列标题)的错误。请忽略它。

It will print out an error for the first line of the CSV (which is actually the column header). Just ignore it.

这篇关于批处理查找文件,复制文件,然后从CSV重命名文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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