<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Поведение команды DIR]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15808&amp;type=atom" />
	<updated>2020-11-09T14:23:14Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15808</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Поведение команды DIR]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=143379#p143379" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>DnsIs пишет:</cite><blockquote><p>PS Разъяснение от Microsoft (см. Примечания)</p></blockquote></div><p>Wow! Они таки сделали это!<br /></p><div class="quotebox"><blockquote><p>Подстановочный знак звездочки всегда использует <span style="color: red">короткое сопоставление имен файлов</span>, поэтому могут возникнуть непредвиденные результаты.</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2020-11-09T14:23:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=143379#p143379</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Поведение команды DIR]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=143365#p143365" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Rumata пишет:</cite><blockquote><p>Я не совсем понял, что именно Вы имели в виду. Я не запускал те конвертеры: только создал файлы командой <strong>type nul &gt; FILENAME</strong> и пролистал содержимое каталога.</p></blockquote></div><p>Я понял, что вы не запускали, просто поверьте мне и удивитесь. Утилиты отработали по разному.</p><br /><p><strong>Закрываем тему.</strong></p><br /><p>PS <a href="https://docs.microsoft.com/ru-ru/windows-server/administration/windows-commands/dir">Разъяснение от Microsoft</a> (см. Примечания)</p>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2020-11-09T04:15:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=143365#p143365</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Поведение команды DIR]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=143309#p143309" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>DnsIs пишет:</cite><blockquote><p>вы обратили внимание, что творят утилиты</p></blockquote></div><p>Я не совсем понял, что именно Вы имели в виду. Я не запускал те конвертеры: только создал файлы командой <strong>type nul &gt; FILENAME</strong> и пролистал содержимое каталога.</p><p>Команды Busybox наследуют соглашениям винды. Можно почитать здесь - <a href="https://frippery.org/busybox/globbing.html">https://frippery.org/busybox/globbing.html</a>.</p><p>Однако вызов &quot;изнутри&quot; самого Busybox работает правильно:<br /></p><div class="codebox"><pre><code>
U:\zzz&gt;busybox64 ls *.doc
x.doc   x.docx

U:\zzz&gt;busybox64 sh -c &quot;ls *.doc&quot;
x.doc
</code></pre></div><p>Это согласуется с Вашим наблюдением </p><div class="quotebox"><blockquote><p>ибо использует WinAPI</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2020-11-07T12:11:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=143309#p143309</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Поведение команды DIR]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=143306#p143306" />
			<content type="html"><![CDATA[<p>Нашел выходы:<br />1. Порнуха:</p><div class="codebox"><pre><code>dir *.xls* | findstr /vrix &quot;[0-9].*\.xls[^.][^.]*&quot;</code></pre></div><p>Рукалицо.</p><p>2. Используем PowerShell.</p><p>3. Используем ls из <a href="https://sourceforge.net/projects/win-bash/files/shell-complete/latest/">shell.w32-ix86.zip</a> (ls из <a href="https://frippery.org/busybox/">BusyBox for windows</a>, тоже не работает, ибо использует WinAPI)</p>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2020-11-07T04:41:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=143306#p143306</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Поведение команды DIR]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=143305#p143305" />
			<content type="html"><![CDATA[<p>Я догадываюсь, что это проблема времен DOS с именами 8.3, но какого черта?</p><p><strong>Rumata</strong>, вы обратили внимание, что творят утилиты:<br /></p><div class="codebox"><pre><code>0101.doc + wordconv.exe = 0101.docx
01.01.doc + wordconv.exe = 01.01.docx

0101.xls + excelcnv.exe = 0101.xlsx
01.01.xls + excelcnv.exe = 01.01.xlsx + 01.01.xlsxx</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2020-11-07T03:42:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=143305#p143305</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Поведение команды DIR]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=143230#p143230" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>С doc-ми все в норме.</p></blockquote></div><p>Неожиданно во всех смыслах. На моей системе одинаково неправильное поведение:<br /></p><div class="codebox"><pre><code>
u:\_!&gt;dir /b *.doc
x.doc
x.docx

u:\_!&gt;dir /b *.xls
x.xls
x.xlsx

u:\_!&gt;for /r %f in ( *.doc ) do @( echo:%f )
u:\_!\x.doc
u:\_!\x.docx

u:\_!&gt;for /r %f in ( *.xls ) do @( echo:%f )
u:\_!\x.xls
u:\_!\x.xlsx
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2020-11-06T12:38:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=143230#p143230</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Поведение команды DIR]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=143211#p143211" />
			<content type="html"><![CDATA[<p>Доброго дня.</p><p>Имеем тестовый каталог с 2 файлами &quot;102.xls&quot;, &quot;102.xlsx&quot;<br /></p><div class="codebox"><pre><code>c:\_!&gt;dir *.xls
...cut
10.2020  16:37            62 976 102.xls
10.07.2020  16:37            62 976 102.xlsx
...cut</code></pre></div><p>Мне не нужен файл xlsx, как обойти сие поведение?<br />--------------------------------------------------------------------------------------------<br />Провожу тест. В каталоге 4 файла:<br /><strong>01.01.doc<br />0101.doc<br />01.01.xls<br />0101.xls</strong><br />и батник:<br /></p><div class="codebox"><pre><code>cmd.cmd
for /R %%f in (*.doc) do copy &quot;%%f&quot; &quot;%%fx&quot;
for /R %%f in (*.xls) do copy &quot;%%f&quot; &quot;%%fx&quot;</code></pre></div><p>Запускаем, получаем:<br /><strong>0101.doc<br />0101.docx</strong></p><p><strong>01.01.doc<br />01.01.docx<br />01.01.docxx</strong></p><p><strong>0101.xls<br />0101.xlsx</strong></p><p><strong>01.01.xls<br />01.01.xlsx<br />01.01.xlsxx</strong><br />Во дела, из-за точки в имени файла возникает какая то фигня.</p><p>Но удивило другое.</p><p>Мне понадобилось сконвертировать множество файлов из xls в xlsx и doc в docx. Казалось бы все просто, простой батник:<br /></p><div class="codebox"><pre><code>for /R %%f in (*.xls) do &quot;C:\Program Files\Microsoft Office\Office16\excelcnv.exe&quot; -oice &quot;%%f&quot; &quot;%%fx&quot;
for /R %%f in (*.doc) do &quot;C:\Program Files\Microsoft Office\Office16\Wordconv.exe&quot; -oice -nme &quot;%%f&quot; &quot;%%fx&quot;</code></pre></div><p>Запускаем в каталоге с теми же файлами<br /><strong>01.01.doc<br />0101.doc<br />01.01.xls<br />0101.xls</strong><br />Результат:<br /><strong>0101.doc<br />0101.docx</strong></p><p><strong>01.01.doc<br />01.01.docx</strong></p><p><strong>0101.xls<br />0101.xlsx</strong></p><p><strong>01.01.xls<br />01.01.xlsx<br />01.01.xlsxx<br /></strong></p><p>С doc-ми все в норме.</p><p>Я в недоумении.<br />Помогайте пожалуйста.</p>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2020-11-06T07:42:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=143211#p143211</id>
		</entry>
</feed>
