강좌 / 팁

소프트웨어 Total commander 에서 검색된 파일들을 폴더 구조와 함께 복사하기 내용추가

2021.03.22 18:49

줄리아니 조회:1181 추천:6

 

https://windowsforum.kr/lecture/12260427 지후빠님께서 아주 잘 설명해 주셨는데요

 

Autohotkey를 이용하여 만들어 보았습니다 

 

사용법은 프로그램 실행후 Total commander 에서 파일을 선택후에 Ctrl+Alt+C 누르시면 반대패널에 폴더구조가 복사됩니다 

 

소스파일과 실행 파일 첨부합니다 

 

 

image.png

 

#SingleInstance force
#Persistent
 
Menu, MyMenu, Add, Copy to &Target Create Folder, Item1
Menu, MyMenu, Add, Copy to &Source Create Folder, Item2
Menu, MyMenu, Add 
Menu, MyMenu, AddMove to Target Create Folder , Item3
Menu, MyMenu, AddMove to Source Create Folder , Item4
Menu, MyMenu, Add 
Menu, MyMenu, Add, Copy to Target With &Folder Structure , Item5
 
^k:: ;Menu hotkey
 
IfWinActiveahk_class TTOTAL_CMD
{
    
    ControlGetFocusControlahk_class TTOTAL_CMD
    If (Control="TMyListBox1" or Control="TMyListBox2" or Control="LCLListBox1" or Control="LCLListBox2")
    {
        Temp:=Clipboard        
        SendMessage 10752030, , , ahk_class TTOTAL_CMD  ; Copy Target path to clipboard
        Target:=clipboard
        SendMessage 10752018, , , ahk_class TTOTAL_CMD ; Copy filenames to clipboard
        FullPathName:=clipboard
        Clipboard:=Temp
        Menu, MyMenu, Show ,650,400
    }
}
 
Return
 
Item1: ;타켓 폴더 만들고 복사
LoopParse, FullPathName, `n, `r
{
    Folder:=RegExMatch(A_LoopField,"^(.+\\)$",File_Path) ;  파일 or 폴더 판별 
 
    if Folder=1
    continue
        
    RegExMatch(A_LoopField,"^(.+\\)(.+)\.",File_Path) ; 파일 이름 알아내기
    Tpath:=Target . "\" . File_Path2
    FileCreateDir , %Tpath%     
    FileCopy, %A_LoopField%, %Tpath%  
}
return
 
Item2: ;소스 폴더 만들고 복사
 
LoopParse, FullPathName, `n, `r
{
    Folder:=RegExMatch(A_LoopField,"^(.+\\)$",File_Path) ; 파일 or 폴더 유무 판별 
    
    if Folder=1
    continue    
   
    RegExMatch(A_LoopField,"^(.+\\)(.+)\.",File_Path) ; 파일 이름 알아내기
    Tpath:=File_Path1 . "\" . File_Path2    
    FileCreateDir , %Tpath%     
    FileCopy, %A_LoopField%, %Tpath% 
}
return
 
Item3: ;타켓으로 폴더 만들고 파일 이동
 
LoopParse, FullPathName, `n, `r
{
    Folder:=RegExMatch(A_LoopField,"^(.+\\)$",File_Path) ;  파일 or 폴더 판별 
 
    if Folder=1
    continue
        
    RegExMatch(A_LoopField,"^(.+\\)(.+)\.",File_Path) ; 파일 이름 알아내기
    Tpath:=target . "\" . File_Path2
    FileCreateDir , %Tpath%     
    FileMove, %A_LoopField%, %Tpath%  
}
return
 
Item4: ;소스로 폴더 만들고 파일 이동
 
LoopParse, FullPathName, `n, `r
{
    Folder:=RegExMatch(A_LoopField,"^(.+\\)$",File_Path) ; 파일 or 폴더 유무 판별 
 
    if Folder=1
    continue
    
    RegExMatch(A_LoopField,"^(.+\\)(.+)\.",File_Path) ; 파일 이름 알아내기
    Tpath:=File_Path1 . "\" . File_Path2    
    FileCreateDir , %Tpath%     
    FileMove, %A_LoopField%, %Tpath%  ; 
}  
 
return
 
^!c:: ;타켓으로 폴더구조를 복사 
 
Item5: ;타켓으로 폴더구조를 복사 
IfWinActiveahk_class TTOTAL_CMD
{
    
    ControlGetFocusControlahk_class TTOTAL_CMD
    If (Control="TMyListBox1" or Control="TMyListBox2" or Control="LCLListBox1" or Control="LCLListBox2")
    {
        Temp:=Clipboard        
        SendMessage 10752030, , , ahk_class TTOTAL_CMD  ; Copy Target path to clipboard
        Target:=clipboard
        SendMessage 10752018, , , ahk_class TTOTAL_CMD ; Copy filenames to clipboard
        FullPathName:=clipboard
        Clipboard:=Temp
    }
 
    LoopParse, FullPathName, `n, `r
    {
        Folder:=RegExMatch(A_LoopField,"^(.+\\)$",File_Path) ; 파일 or 폴더 여부 확인
    
        if Folder=1
        {
            RegExMatch(A_LoopField,"(?<=[a-zA-Z]:).+\\$",Folder_Path) ; 폴더경로 추출     
            Tpath:=Target . "\" . Folder_Path   
            FileCopyDir %A_LoopField%, %Tpath% ,1
        }
    
        else
        {
            RegExMatch(A_LoopField,"(?<=[a-zA-Z]:).+\\(?=.+)",File_Path) ; 파일경로 추출 
            Tpath:=Target . "\" . File_Path 
            FileCreateDir , %Tpath%     
            FileCopy, %A_LoopField%, %Tpath% 
        }
    }
}
 
Return

 

수정 버전 첨부합니다 

 

image.png

 

 

 

Tc에서 파일 선택후 Ctrl+K 누르면 다음과 같은 메뉴가 뜹니다 

Copy to target create foler 는 TC 반대 패널에 파일이름으로 폴더를 만들고 파일 복사를 합니다 

Move to target create folder는 TC 반대 패널에 파일이름으로 폴더를 만들고 파일 이동을 합니다  

파일만 복사합니다 폴더는 복사하지 않습니다 

 

Copy to target with folder structure 는 파일 구조를 복사를 하며 단축키는 Ctrl+Alt+S 입니다 

파일과 폴더 둘다 복사합니다 

번호 제목 글쓴이 조회 추천 등록일
[공지] 강좌 작성간 참고해주세요 gooddew - - -
370 소프트웨어| [팁] medengine.log 란 파일이 지워지지 않을 때 [2] asklee 2596 6 01-25
369 소프트웨어| 토탈커맨더 - 버튼에 포커스 이동 - 단축키 [8] shot4u 2235 6 10-21
368 소프트웨어| Total Commander에서 image converter 사용예제 [4] 지후빠 1174 6 03-11
367 소프트웨어| 암호 관리 프로그램 KeePass를 파이어폭스에 적용해보기 (F... [12] Waffen-SS 1555 6 10-09
366 소프트웨어| FASTKEYS 런처 기능 소개 BecauseI 1534 6 10-10
365 소프트웨어| 크롬 깔끔하지만 복잡한 설치 누군가 2266 6 02-16
364 소프트웨어| UNetbootin (Universal Netboot Installer) 범용 Netboot ... [3] VenusGirl 1088 6 06-11
363 소프트웨어| 너튜브 재생시 끊김현상 안되시는분? [4] 메인보드 1690 6 08-29
362 소프트웨어| S3. 번역기-Firefox+Google Chrome용 부가 기능: 한국어 지원 [2] VₑₙᵤₛG 1130 6 11-24
361 소프트웨어| nircmd.exe 다운 받아 windir에 복사하기 ps1 ahk [19] 지후빠 905 6 01-05
360 소프트웨어| 디펜터에서 화일 바이러스 잡을경우 해결방법 [1] 조랑말 2167 6 03-20
» 소프트웨어| Total commander 에서 검색된 파일들을 폴더 구조와 함께 ... [8] 줄리아니 1181 6 03-22
358 소프트웨어| OpenVPN 속도 개선 [1] Antory 2389 6 04-14
357 소프트웨어| 네트워크 PC의 원격 Everything (DB) 검색 BAT,AHK [2] 지후빠 1718 6 09-02
356 소프트웨어| 언패킹 후 리소스 재구축하기-1 [16] sunshine 992 6 10-13
355 소프트웨어| Symantec Endpoint Protection 자동 업데이트 설정하기 [4] kisslady 1027 6 07-22
354 소프트웨어| FastCopy 토탈커맨더 연동 [14] 슈머슈마 1540 6 02-26
353 소프트웨어| 비즈니스용 MS Office365 신규 UI적용하기 [2] 마집사 2663 6 05-27
352 소프트웨어| Symantec Endpoint Protection(SEP) 삭제방법(삭제시 비밀... [3] 타천사둘리 2132 6 06-28
351 소프트웨어| X32dbg 이용한 언팩 강좌 입니다 [4] 줄리아니 909 6 08-06
XE1.11.6 Layout1.4.8