<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Переименование файлов по размеру]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11527&amp;type=atom" />
	<updated>2016-04-24T13:50:15Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11527</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переименование файлов по размеру]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=102940#p102940" />
			<content type="html"><![CDATA[<p>Возможна ли в этом коде, еще одна модификация, обрабатывать данным образом только паки, где найдены файлы registrator.txt или partner.txt</p>]]></content>
			<author>
				<name><![CDATA[zetix]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33849</uri>
			</author>
			<updated>2016-04-24T13:50:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=102940#p102940</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переименование файлов по размеру]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=102922#p102922" />
			<content type="html"><![CDATA[<p><strong>greg zakharov</strong>Работает, спасибо огромное. Очень познавательный код.</p>]]></content>
			<author>
				<name><![CDATA[zetix]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33849</uri>
			</author>
			<updated>2016-04-24T11:17:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=102922#p102922</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переименование файлов по размеру]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=102917#p102917" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>@echo off
  setlocal
    set &quot;p=D:\test&quot;
    call:extchange %p%
    for /f &quot;tokens=*&quot; %%i in (
      &#039;dir /ad /b /s %p%&#039;
    ) do call:extchange &quot;%%~i&quot;
  endlocal
exit /b

:extchange
  pushd &quot;%~1&quot;
    for /f %%i in (
      &#039;dir /a-d *.txt ^| find /n /i /c &quot;.txt&quot;&#039;
    ) do (
      if %%i equ 1 ren *.txt *.log &amp; goto:end
      if %%i equ 2 (
        for /f &quot;tokens=*&quot; %%i in (
          &#039;dir /a-d /os *.txt /b&#039;
        ) do set &quot;lf=%%~i&quot;
      )
    )
    ren &quot;%lf%&quot; &quot;%lf:.txt=.log%&quot;
    :end
  popd
exit /b</code></pre></div>]]></content>
			<author>
				<name><![CDATA[greg zakharov]]></name>
			</author>
			<updated>2016-04-24T10:54:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=102917#p102917</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переименование файлов по размеру]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=102916#p102916" />
			<content type="html"><![CDATA[<p><strong>greg zakharov</strong>&nbsp; Спасибо, замечательный код! Был бы очень благодарен если добавили бы в него возможность поиска по всему дереву каталога, а не в отдельно взятой папке. Потому как сейчас, в случае нахождения&nbsp; подпапки приходится вручную&nbsp; менять путь. К примеру D:\test\temp\temp2.</p>]]></content>
			<author>
				<name><![CDATA[zetix]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33849</uri>
			</author>
			<updated>2016-04-24T10:39:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=102916#p102916</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Переименование файлов по размеру]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=102910#p102910" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>@echo off
  setlocal
    pushd D:\test
      for /f %%i in (
        &#039;dir /a-d *.txt ^| find /n /i /c &quot;.txt&quot;&#039;
      ) do (
        if %%i equ 1 ren *.txt *.log &amp;goto:end
        if %%i equ 2 (
          for /f &quot;tokens=*&quot; %%i in (
            &#039;dir /a-d /os *.txt /b&#039;
          ) do set &quot;lf=%%~i&quot;
        )
      )
      ren &quot;%lf%&quot; &quot;%lf:.txt=.log%&quot;
      :end
    popd
  endlocal
exit /b</code></pre></div>]]></content>
			<author>
				<name><![CDATA[greg zakharov]]></name>
			</author>
			<updated>2016-04-24T09:30:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=102910#p102910</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Переименование файлов по размеру]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=102894#p102894" />
			<content type="html"><![CDATA[<p>Добрый день. Написал после долгих мучений такой код.<br /></p><div class="codebox"><pre><code>for /r &quot;D:\Test&quot; %%i in (*.txt?) do ren &quot;%%i&quot; *.log</code></pre></div><p>Меняет расширение всех фалов в D:\Test с .txt на .log, проблема в том, что необходимо в случае нахождения в папке более одного файла .txt, сменить расширение только у большего по размеру, остальные пропустить.</p>]]></content>
			<author>
				<name><![CDATA[zetix]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33849</uri>
			</author>
			<updated>2016-04-23T19:05:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=102894#p102894</id>
		</entry>
</feed>
