帮助批处理文件将子目录中的文件复制到目录内

发布于 2024-10-02 09:24:02 字数 368 浏览 0 评论 0原文

任何人都可以为我提供一个通过子目录的 dos 批处理循环,以使用同一目录中的子目录名称将文件复制到同一目录中的另一个文件。

示例:

电影 => 阿拉丁=> wd_tv.jpg

想要将同一目录中的 wd_tv.jpg 复制到“directoryname”_sheet.jpg 因此,批处理运行后目录将是:

Moves => 阿拉丁=> wd_tv.jpg, Aladdin_sheet.jpg

Aladdin_sheet.jpg 是复制并重命名的 wd_tv.jpg。 希望有可能 提前致谢。

Can anyone provide me with a dos batch loop thru sub directories to copy a file to within the same directory to another file using the sub directory name within the same directory.

Example:

Movies =>
Aladdin =>
wd_tv.jpg

Would like to copy wd_tv.jpg within same dir to "directoryname"_sheet.jpg
So after the batch has run the directory would be:

Moves =>
Aladdin =>
wd_tv.jpg,
Aladdin_sheet.jpg

With Aladdin_sheet.jpg being the wd_tv.jpg copied and renamed.
Hope its possible
Thks In Advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晚风撩人 2024-10-09 09:24:02

将此批处理文件复制到电影目录并在那里执行。

@echo off
for /d %%a in (*) do call :rendir %%a

echo finished
pause
goto :eof

:rendir
pushd %1
echo renaming *.jpg to %1_sheet.jpg
ren *.jpg %1_sheet.jpg
popd

goto :eof

:eof

Copy this batchfile to the movies direcory and execute it there.

@echo off
for /d %%a in (*) do call :rendir %%a

echo finished
pause
goto :eof

:rendir
pushd %1
echo renaming *.jpg to %1_sheet.jpg
ren *.jpg %1_sheet.jpg
popd

goto :eof

:eof
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文