Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Поиск каталогов с файлами определенного типа

 
Post new topic   Reply to topic    Total Commander Forum Index -> Общие вопросы printer-friendly view
View previous topic :: View next topic  
Author Message
WildDIC



Joined: 18 Feb 2005
Posts: 21

Post (Separately) Posted: Sun Jan 15, 2006 21:58    Post subject: Поиск каталогов с файлами определенного типа Reply with quote

Как можно найти все каталоги (и только каталоги), в которых содержатся файлы определенного типа?
Например, надо получить список каталогов, в которых есть файлы с расширением TXT. Что-то результат моих экспериментов никакого эффекта не дал Sad

 !  Avada:
Перемещено из Секретов и советов в Общие вопросы. Заголовок отредактирован.
Back to top
View user's profile Send private message
Evgenych



Joined: 25 Jan 2005
Posts: 53

Post (Separately) Posted: Mon Jan 16, 2006 01:05    Post subject: Reply with quote

Например, так.
Делаешь кнопку на панели инструментов:
Команда: cmd.exe /c
Параметры: for /f %%i in ('dir /b /s /ad') do if exist %%i\*.txt echo %%i >> 1.txt
Путь: пусто

И в фале 1.txt получаешь нужный тебе список.


з.ы. только для winnt\xp\2000\2003
Back to top
View user's profile Send private message
Batya



Joined: 15 Dec 2004
Posts: 2218
Location: Москва, Россия

Post (Separately) Posted: Mon Jan 16, 2006 12:17    Post subject: Reply with quote

Можно использовать плагин ScriptContent.
script.ini:
Code:
[Script]
Section=File Types In Dir

[File Types In Dir]
Script=FileTypesInDir.vbs
LongName=1
ParseDirs=1


FileTypesInDir.vbs:
Code:
Dim FSO, Fold, FilesInFold, ScanFile, FileExt
Set FSO = CreateObject("Scripting.FileSystemObject")
content = ""
If FSO.FolderExists(filename) Then
  Set Fold = FSO.GetFolder(filename)
  Set FilesInFold = Fold.Files
  On Error Resume Next
  For Each ScanFile in FilesInFold
    FileExt = FSO.GetExtensionName(ScanFile.Path)
    If FileExt = "" Then
      FileExt = " "
    End If
    If Instr(1, content, FileExt, 1) = 0 Then
      content = content & "," & FileExt
    End If
  Next
  On Error GoTo 0
  If Len(content) > 0 Then
    content = Mid(content, 2)
  End If
  Set Fold = Nothing
  Set FilesInFold = Nothing
End If
Set FSO = Nothing

Скрипт сделал так, что он возвращает для папок расширения файлов, перечисленные через запятую. Если файл без расширения, то я в эту строку вставляю пробел.

Т.о., при поиске из TC переходим на закладку "Плагины", ставим "Поиск с плагинами", выбираем:
Плагин = script,
Свойство = Result,
Операция = "содержит",
Значение (например) = txt.

Для ускорения поиска на закладке "Дополнительно" можно установить Атрибут - Каталог.
Back to top
View user's profile Send private message
WildDIC



Joined: 18 Feb 2005
Posts: 21

Post (Separately) Posted: Wed Jan 18, 2006 16:08    Post subject: Reply with quote

Спасибо.
Долго эксперементировал - скрипт не хотел работать.
Все решилось просто - оказалось, что плагин чуть-чуть обновился.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Общие вопросы All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group