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 

Single Post  Topic: Перемещение всех файлов в корневую папку 
Author Message
Batya



PostPosted: Thu Apr 28, 2011 10:31    Post subject: Reply with quote

den114
vbs-скрипт:
Code:
'=====================================================================
' Перемещение файлов в корневую папку (верхнюю)

' Параметры:
' {файл-список корневых папок}

' Пример параметров при вызове из TC:
' %L
'=====================================================================

Dim FSO, F
Set FSO = CreateObject("Scripting.FileSystemObject")

With FSO.OpenTextFile(WScript.Arguments(0), 1)
  Do While Not .AtEndOfStream
    F = Trim(.ReadLine)
    If F <> "" Then
      If FSO.FolderExists(F) Then
        If Right(F, 1) <> "\" Then F = F & "\"
        Process F, F
      End If
    End If
  Loop
End With

Set FSO = Nothing
Wscript.Quit()

Sub Process(pPath, pTarget)
  Dim lF
  For Each lF in FSO.GetFolder(pPath).SubFolders
    Process lF.Path & "\", pTarget
  Next
  If LCase(pPath) <> LCase(pTarget) Then
    For Each lF in FSO.GetFolder(pPath).Files
      'Если файл с целевым именем существует, предварительно удаляем его
      If FSO.FileExists(pTarget & lF.Name) Then FSO.DeleteFile pTarget & lF.Name, True
      lF.Move pTarget
    Next
  End If
End Sub

_________________
Нет, я не сплю. Я просто медленно моргаю.
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group