<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Удаление файлов в подпапках с определённым расширением]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11340&amp;type=atom" />
	<updated>2022-10-07T11:08:19Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11340</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=155100#p155100" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>В скрипте использован устаревший синтаксис перебора файлов. Смотрите тут, обратите внимание на параметр Mode.</p></blockquote></div><p>Спасибо! Помогло.<br />Я уже сделал переименование в BulkRenameUtility, там есть поддержка regex (с включенной галкой v2), но запускать ее каждый раз дольше, чем запустить скрипт AHK.</p>]]></content>
			<author>
				<name><![CDATA[viviancels]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42788</uri>
			</author>
			<updated>2022-10-07T11:08:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=155100#p155100</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=155099#p155099" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>viviancels пишет:</cite><blockquote><p>Тогда не будет расширения, так как в переменной его нет</p></blockquote></div><p>А, да, не очень внимательно посмотрел.<br /></p><div class="quotebox"><cite>viviancels пишет:</cite><blockquote><p>Главная проблема в том, что не обрабатываются файлы в подпапках.</p></blockquote></div><p>В скрипте использован устаревший синтаксис перебора файлов. Смотрите <a href="https://www.autohotkey.com/docs/commands/LoopFile.htm">тут</a>, обратите внимание на параметр Mode.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-10-07T10:33:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=155099#p155099</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=155097#p155097" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Просто уберите лишний .jpg. Здесь</p></blockquote></div><p>Тогда не будет расширения, так как в переменной его нет, в общем, я убрал .jpg из FileMove и перенес его в переменную, добавив после $1. Теперь можно запускать скрипт повторно, лишнего расширения не добавляется</p><p>Главная проблема в том, что не обрабатываются файлы в подпапках.</p>]]></content>
			<author>
				<name><![CDATA[viviancels]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42788</uri>
			</author>
			<updated>2022-10-07T10:23:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=155097#p155097</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=155095#p155095" />
			<content type="html"><![CDATA[<p>Просто уберите лишний .jpg. Здесь<br /></p><div class="codebox"><pre><code>FileMove, %A_LoopFileFullPath%, %outFolder%\%newName%.jpg</code></pre></div><p>переменная newName уже содержит .jpg. Вы можете убедиться в этом, если перед данной строкой выведите её значение в MsgBox. Так же с помощью MsgBox вы легко можете посмотреть, что находится в переменной A_LoopFileFullPath.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-10-07T09:53:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=155095#p155095</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=155088#p155088" />
			<content type="html"><![CDATA[<p>Здравствуйте. У меня схожая задача, только вместо удаления - переименование файлов в подпапках. Скрипт лежит рядом с папкой &quot;folder&quot; и работает только для файлов в папке &quot;folder&quot;, а до файлов в подпапках его работа не доходит. Где-то ошибка:</p><div class="codebox"><pre><code>
inFolder := A_ScriptDir &quot;\folder&quot;
outFolder := A_ScriptDir &quot;\folder&quot;
Loop, %inFolder%\*
{
    ; Новое имя
    newName := RegExReplace(A_LoopFileName, &quot;\[(.*?)\].*.jpg&quot;, &quot;$1&quot;)

    ; Переименование
    FileMove, %A_LoopFileFullPath%, %outFolder%\%newName%.jpg
}

return

Esc::
ExitApp
</code></pre></div><p>Еще у этого скрипта есть особенность: если запустить его второй раз, то он добавляет расширение .jpg к файлам, которые уже переименованы с его помощью. Получается картинка.jpg.jpg</p><p>Еще вопрос: Так как у&nbsp; FilePattern (A_ScriptDir &quot;\folder&quot;) относительный путь, а не полный, то %A_LoopFileFullPath% здесь это папка &quot;folder&quot;?</p>]]></content>
			<author>
				<name><![CDATA[viviancels]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42788</uri>
			</author>
			<updated>2022-10-07T07:10:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=155088#p155088</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=148562#p148562" />
			<content type="html"><![CDATA[<p><strong>flightlex</strong>, отлично, но код должен быть оформлен в соответствии с <a href="https://forum.script-coding.com/misc.php?action=rules">правилами</a>, я отредактировал ваш пост. Кроме того, вместо<br /></p><div class="codebox"><pre><code>Folder = C:\Users\имя_ползователя\AppData\Local\Temp</code></pre></div><p>можно просто<br /></p><div class="codebox"><pre><code>Folder := A_Temp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-06-22T01:58:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=148562#p148562</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=148561#p148561" />
			<content type="html"><![CDATA[<p>Вообщем, я разработал скрипт, легкий очень, буквально за 5 минут, которые очищает из папки &quot;%temp%&quot; и &quot;temp&quot; все, кроме папок, к тому же там можно изменить путь, и очищать папки помимо &quot;%temp%&quot; и &quot;temp&quot;.<br />Вот код</p><div class="codebox"><pre><code>Folder = C:\Users\имя_ползователя\AppData\Local\Temp
	FileDelete, %Folder%\*.*

Folder2 = C:\Windows\temp
	FileDelete, %Folder2%\*.*
Return
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[flightlex]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41823</uri>
			</author>
			<updated>2021-06-22T01:13:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=148561#p148561</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101265#p101265" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong><br />Спасибо !</p>]]></content>
			<author>
				<name><![CDATA[seriousstas]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32974</uri>
			</author>
			<updated>2016-02-20T12:37:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101265#p101265</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101264#p101264" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Folder = путь к папке
Loop, %Folder%\*, 2
	FileDelete, %A_LoopFileLongPath%\*.jpg
Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-02-20T11:26:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101264#p101264</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101262#p101262" />
			<content type="html"><![CDATA[<p>Почитайте здесь-<a href="http://www.script-coding.com/AutoHotkey/FileDelete.html">http://www.script-coding.com/AutoHotkey/FileDelete.html</a></p>]]></content>
			<author>
				<name><![CDATA[Zanoza]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26155</uri>
			</author>
			<updated>2016-02-20T11:09:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101262#p101262</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Удаление файлов в подпапках с определённым расширением]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101261#p101261" />
			<content type="html"><![CDATA[<p>Есть папка <strong>artists</strong><br />В ней создаются автоматом папки(без дополнительных подпапок) с названием , заранее неизвестным .<br />Нужно удалить из всех этих подпапок файлы с расширение *.jpg</p><p>пока получилось удалять все :<br /></p><div class="codebox"><pre><code>SetWorkingDir %A_ScriptDir%
FileRemoveDir, %A_ScriptDir%\artists , 1</code></pre></div><p>но сами папки нужно оставлять .</p><p>Помогите с этим.</p>]]></content>
			<author>
				<name><![CDATA[seriousstas]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32974</uri>
			</author>
			<updated>2016-02-20T10:49:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101261#p101261</id>
		</entry>
</feed>
