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: Script Request 
Author Message
Flasher



PostPosted: Mon Jun 27, 2011 16:00    Post subject: Reply with quote

Code:
'===========================================
' Перемещение выделенных файлов и папок на уровень вверх
' с переходом в родительский каталог активной папки
' Параметры: %L <любой символ>
' второй параметр необязательный - если стоит, то переходить
'===========================================
With CreateObject("Scripting.FileSystemObject")
Set TempFile = .OpenTextFile(WScript.Arguments(0), 1)
Do While Not TempFile.AtEndOfStream
  N = TempFile.ReadLine
  If .FolderExists(N) Then
    Set F = .GetFolder(N)
    TargetPath = F.ParentFolder.ParentFolder
    If Not .FolderExists(TargetPath & "\" & .GetFolder(N).Name) Then
      .MoveFolder F, TargetPath & "\"
    Else
      F.Copy TargetPath & "\" & .GetFolder(N).Name & "_Copy"
      F.Delete
    End If
  End If
  If .FileExists(N) Then
    Set F = .GetFile(N)
    TargetPath = F.ParentFolder.ParentFolder
    If Not .FileExists(TargetPath & "\" & F.Name) Then
      .MoveFile F, TargetPath & "\"
    Else
      F.Copy TargetPath & "\" & .GetBaseName(N) &"_Copy." & .GetExtensionName(N)
      F.Delete
    End If
  End If
Loop
End With
If WScript.Arguments.Count>1 Then _
CreateObject("WScript.Shell").Exec("%COMMANDER_PATH%\Totalcmd.exe /O /S /L=""" & TargetPath & """")
Wscript.Quit
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group