获取变量中缺少指定文件的文件夹路径 [英] Get a folder path where is missing specified file into variable
问题描述
假设我有两个文件夹一个.
MyFolder \ Folder1 \-包含 .class 和 .java 文件
MyFolder\Folder1\ - contains .class and .java file
MyFolder \ Folder2 \-仅包含 .class 文件
MyFolder\Folder2\ - contains only .class file
问题是,是否可以使批处理文件检测(MyFolder)中缺少.java文件的文件夹,然后将路径放入变量中.
The question is, if you can make the batch file detect the folder in (MyFolder) where is a .java file missing and put the path into a variable.
类似的东西:
Something like:
在MyFolder \中查找没有* .java文件的子文件夹/-并且以某种方式将文件夹路径放入变量
find sub/folder with no *.java files in MyFolder\ <-and somehow to put the folder path into a variable
有人知道脚本的外观吗? 感谢每个人的帮助.
Does anyone know what would the script look like? Thanks to everybody that will help.
推荐答案
这里是一个想法,您可以对其进行处理以使其适合您的需求:
Here is an idea, you can work on it to make it suit your needs:
Setlocal EnableDelayedExpansion
for /D %%f in (MyFolder\*) do if not exist %%f\*.java (
set nonJavaFolder=%%f
)
echo !nonJavaFolder!
这篇关于获取变量中缺少指定文件的文件夹路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!