강좌 / 팁

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

2021.03.22 18:49

줄리아니 조회:1176 추천: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 - - -
4400 윈 도 우| [실사] VHD 교차부팅 수동&자동 등록 [18] 무월 1975 32 10-07
4399 소프트웨어| EDGE 브라우저 창 크기 "최대화" 고정 하기 [1] 미스라 1482 6 10-03
4398 윈 도 우| [갱신] 윈도우 11 로컬 계정 암호 변경 [14] 무월 2244 18 09-27
4397 소프트웨어| 테라카피(Teracopy) 3.12 설치팁 [7] 메리아 2318 17 09-27
4396 소프트웨어| PDF-XChange Editor 기본글꼴 바꾸기 [1] 코리아선비 890 3 09-25
4395 윈 도 우| Windows 11에서 광고 팝업을 끄는 방법 [5] VᴇɴᴜꜱGɪ 3098 8 09-22
4394 소프트웨어| [포토샵] 인물 누끼따기 외곽선 정리 [12] 무월 2555 37 09-20
4393 윈 도 우| 윈도우 11 로컬 계정 암호 재설정 [15] 무월 1778 29 09-18
4392 윈 도 우| 윈도우11 에서 창 깜박거림이나 입력글자가 사라지는 경우 [5] Named 1558 2 09-14
4391 소프트웨어| PE 동영상 썸네일 표시 [3] 히이이잌 674 16 09-14
4390 모 바 일| [팁] 카톡 '전화번호로 친구 추가 허용' 기능 추가 [2] asklee 1595 4 09-13
4389 윈 도 우| Microsoft는 최근 Windows 11 WinRE 업데이트가 실패한 이... [2] VᴇɴᴜꜱGɪ 1497 4 09-10
4388 윈 도 우| 바로가기 아이콘을 만들어 원 클릭으로 디펜더 온 오프 메... [8] heykevin 1298 20 09-09
4387 소프트웨어| 64bit 프로그램 한글화 강좌 [4] 夕影 1757 7 09-09
4386 소프트웨어| [엑셀] 선택된 셀, 행, 열 강조 하기! [13] 무월 2560 28 08-31
4385 소프트웨어| Microsoft Edge를 사용하여 YouTube 스크린샷을 찍는 방법 [3] Security_Z 1347 5 08-30
4384 윈 도 우| [실사] 윈도우 11 VHD 교차부팅(자동) 설정 - VHDMan [16] 무월 1952 35 08-26
4383 소프트웨어| Microsoft Edge IE모드 구성하기 [10] 무월 1836 22 08-26
4382 윈 도 우| [3탄] PE빌드를 위한 누적 업데이트 통합 (Winre.wim + ins... [14] 무월 1275 26 08-25
4381 윈 도 우| 텍스트 파일 하위 폴더 파일 포함 병합하기! [11] 무월 820 27 08-23
XE1.11.6 Layout1.4.8