강좌 / 팁

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

2021.03.22 18:49

줄리아니 조회:1173 추천: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 - - -
3909 윈 도 우| [팁] MBR 디스크에 EFI 시스템 파티션 만들기 [16] suk 5600 24 04-19
3908 서버 / IT| Windows Server RDS 라이선스 활성화 및 구성 [7] 펨토 1271 1 04-15
3907 소프트웨어| OpenVPN 속도 개선 [1] Antory 2371 6 04-14
3906 소프트웨어| Microsoft Edge의 작업 영역 기능에 대해 살펴보기 VₑₙᵤₛG 1030 2 04-13
3905 서버 / IT| Linux에 Microsoft Edge를 설치하기 [1] VₑₙᵤₛG 1323 0 04-07
3904 서버 / IT| 헤놀로지 918+ letsencrypt 인증서 해결 내꼬 1525 4 04-05
3903 하드웨어| 유무선공유기 QOS 진실 [5] 내꼬 3647 5 04-02
3902 윈 도 우| Administrator ==> User [15] @카리스마 4344 26 04-02
3901 소프트웨어| PE.wim 파일에 사용 할 엡 파일 수정하거나 추가 하기와 ... [14] 좋은이웃 2035 14 04-01
3900 소프트웨어| 성경 베들레헴_4.32_불필요 파일 삭제하기 [13] 좋은이웃 1657 5 04-01
3899 소프트웨어| PE 해상도 변경하기 [5] 좋은이웃 2187 13 04-01
3898 서버 / IT| Windows 내 파일을 누가 삭제 했을까? [2] 펨토 1874 6 03-31
3897 윈 도 우| 가끔쓰는 도스 명령어 대신 메뉴로 관리하자(BAT포함) [8] 멀더는외계 2129 20 03-31
3896 윈 도 우| 내가 접속한 와이파이 비밀번호 알아내기(Bat파일 포함) [6] 멀더는외계 2344 4 03-31
3895 서버 / IT| 윈도우 보안 취약점 따라하기 및 스크립트 만들기 [8] 펨토 1522 7 03-28
3894 소프트웨어| [Tip] 윈도우용 PuTTY 설정 백업 [3] asklee 1091 2 03-28
3893 윈 도 우| 유니버설 미디어 생성 도구 - Windows 10 21H1 지원 도구 [3] VₑₙᵤₛG 1641 8 03-27
3892 윈 도 우| bios 부팅과 uefi 부팅 기본개념 [4] 영구당 3353 6 03-25
3891 윈 도 우| 할당되지 않은 공간...1MB? [4] 밤이슬216 2216 5 03-24
» 소프트웨어| Total commander 에서 검색된 파일들을 폴더 구조와 함께 ... [8] 줄리아니 1173 6 03-22
XE1.11.6 Layout1.4.8