강좌 / 팁

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

2021.03.22 18:49

줄리아니 조회:1177 추천: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 - - -
3921 윈 도 우| Windows ISO의 정확한 빌드 번호 확인하기 [3] suk 1680 13 05-11
3920 모 바 일| 2개의 동영상을 합성하는 방법 Kinemaster강좌 무림거사 1872 5 05-10
3919 하드웨어| HDD Firmware 를 복사해서 데이터 복구하기 [4] gooddew 1951 13 05-09
3918 윈 도 우| Windows Terminal 우클릭 제거하기 [5] suk 2052 10 05-01
3917 소프트웨어| USB Bios + UEFI 듀얼부팅06 - Usb 포맷없이 [3] 카멜 3208 15 04-30
3916 소프트웨어| Photoshop 2021에서 사전 설정 동기화 안내 안 나오게 하기 [5] 봄빛깔 1367 7 04-29
3915 기 타| USB 메모리 보다는 외장 SSD/하드 가 필요한 이유 [17] 디폴트 3725 11 04-29
3914 윈 도 우| [참조] 표준 방식의 포맷으로 BIOS UEFI 겸용 부팅 [3] 디폴트 1741 4 04-28
3913 소프트웨어| USB Bios + UEFI 듀얼부팅 - Rufus 없이 [6] 카멜 2460 22 04-28
3912 하드웨어| NVME 980 PRO를 Z170(PCIE 3.0)에 사용하면? [6] 밤이슬216 1716 4 04-25
3911 윈 도 우| VMware로 설치한 윈7,8에서 Ophcrack 안돌려지는 경우 누군가 705 1 04-23
3910 서버 / IT| SQL Server Port 변경 및 접속 확인 펨토 630 1 04-22
3909 윈 도 우| [팁] MBR 디스크에 EFI 시스템 파티션 만들기 [16] suk 5633 24 04-19
3908 서버 / IT| Windows Server RDS 라이선스 활성화 및 구성 [7] 펨토 1273 1 04-15
3907 소프트웨어| OpenVPN 속도 개선 [1] Antory 2375 6 04-14
3906 소프트웨어| Microsoft Edge의 작업 영역 기능에 대해 살펴보기 VₑₙᵤₛG 1037 2 04-13
3905 서버 / IT| Linux에 Microsoft Edge를 설치하기 [1] VₑₙᵤₛG 1327 0 04-07
3904 서버 / IT| 헤놀로지 918+ letsencrypt 인증서 해결 내꼬 1533 4 04-05
3903 하드웨어| 유무선공유기 QOS 진실 [5] 내꼬 3652 5 04-02
3902 윈 도 우| Administrator ==> User [15] @카리스마 4350 26 04-02
XE1.11.6 Layout1.4.8