@ECHO OFF
SETLOCAL
:: starting directory
SET "relroot=u:"
(
FOR /f "delims=" %%i IN ( 'dir /s /b /a-d "%relroot%\*.dtsx" ') DO (
FOR /f "delims=" %%m IN ("%%~dpi.") DO (
FOR /f "delims=" %%q IN ("%%~dpm.") DO (
ECHO "%%~nxi" "%%~nq"
)
)
)
)>"%temp%\tempfile_name"
SORT "%temp%\tempfile_name" >"%temp%\tempfile_anothername"
GOTO :EOF
这是一个首发。
该文件"%temp%\tempfile_name"
应包含格式的行
"file3.dtsx" "m"
该文件"%temp%\tempfile_anothername"
应包含这些行,并按文件名的字母顺序进行排序。
不确定是否需要引号、需要的元素顺序、需要的输出顺序,或者您是否还需要"z"
目录(它可以作为%%~nm
)
附录以下评论 20130703-1355Z
天啊!混乱开始!
Stackexchange 的定期收件箱通知包括一小部分发布的评论,并阅读了两个连续的报告:
... ,D:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity\Folder\File1_1.dtsx ;
... D:\Data Migration\DX\AE_Deployment_SAT\20-Interfaces\Flex Att Per
然而,其中第二个并未出现在当前可用的评论中。
这是我用来创建当前评论中报告的文件的批次-我所做的只是编辑驱动器号-我什至将其保留Entity
为张贴而不是Entity1
叙述:
@echo off
setlocal
del /s u:\*.dtsx
md "U:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity\Folder" 2>nul
md "U:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity1\Folder" 2>nul
md "U:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity2\Folder" 2>nul
copy nul "U:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity\Folder\File1_1.dtsx
copy nul "U:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity1\Folder\File1_2.dtsx"
copy nul "U:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity2\Folder\File1_3.dtsx"
copy nul "U:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity2\Folder\File1_4.dtsx"
dir/s u:\*.dtsx
结果:
u:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity\Folder\File1_1.dtsx
u:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity1\Folder\File1_2.dtsx
u:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity2\Folder\File1_3.dtsx
u:\Folder 1\SubFolder1\SubFolder2_SubFolder3\SubFolder4\Entity2\Folder\File1_4.dtsx
运行我原来贴的批处理"%%~nm"
就ECHO
行了,有修正
...
SORT "%temp%\tempfile_name" >"%temp%\tempfile_anothername"
type "%temp%\tempfile_name"
echo================================
TYPE "%temp%\tempfile_anothername"
GOTO :EOF
结果是:
"File1_1.dtsx" "Entity" "Folder"
"File1_2.dtsx" "Entity1" "Folder"
"File1_3.dtsx" "Entity2" "Folder"
"File1_4.dtsx" "Entity2" "Folder"
===============================
"File1_1.dtsx" "Entity" "Folder"
"File1_2.dtsx" "Entity1" "Folder"
"File1_3.dtsx" "Entity2" "Folder"
"File1_4.dtsx" "Entity2" "Folder"
所以 - 对我有用。不知道您实际想要生产什么,不幸的是您似乎正在审查结果。我只能使用您提供的数据... :(