강좌 / 팁

소프트웨어 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 - - -
946 소프트웨어| 기상 정보-Forecastfox - Firefox+Google Chrome용 부가 기능 [3] VenusGirl 1176 9 12-31
945 소프트웨어| Adobe Premiere CS6 강좌 유용한 팀Tip 몇가지 -복사단축키... [1] murimgasa 1177 1 08-25
» 소프트웨어| Total commander 에서 검색된 파일들을 폴더 구조와 함께 ... [8] 줄리아니 1177 6 03-22
943 소프트웨어| 팁: VirtualBox 7의 Windows 10/11에서 NVMe 드라이버 활성... [3] VᴇɴᴜꜱGɪ 1188 9 03-05
942 소프트웨어| command prompt 에서 메일 보내기 [5] shot4u 1192 4 12-17
941 소프트웨어| Win10XPE - Desktop.INI 삭제 과정 안 보이게 하기. [3] 입니다 1196 8 07-19
940 소프트웨어| 마우스 두개 양손 사용시 왼손 마우스 버튼 스왑 [7] 지후빠 1208 12 12-24
939 소프트웨어| 다중 웹 검색 - Firefox 및 Chrome 부가 기능 [1] VenusGirl 1209 3 05-22
938 소프트웨어| 토탈커맨더 - 좌우 패널 폭 조정 단축키 [3] shot4u 1213 2 12-06
937 소프트웨어| SearchPreview - 웹 사이트의 미리보기 이미지 - Firefox +... VenusGirl 1216 2 01-06
936 소프트웨어| 중국어 프로그램 한글화 팁 [8] 줄리아니 1222 16 08-14
935 소프트웨어| 사무실 사용자 지정 설치 위해 ODT 관련 [1] RoyalS 1229 2 01-06
934 소프트웨어| [OP]GoodbyeDPI 0.1.6 Open Source Platform [1] Antory 1242 2 01-28
933 소프트웨어| 토탈커맨더 도구바 버튼 매개변수 없이 실행 AHK [23] 지후빠 1260 9 09-19
932 소프트웨어| 토탈커맨더 양쪽창 화면 비율 조절용 단축키설정 [18] 지후빠 1272 7 06-17
931 소프트웨어| 파일 이름 일치시키기 개선 - VBS & VTool [7] 지후빠 1277 11 04-26
930 소프트웨어| 크롬/엣지에서 URL 드래그 드롭으로 제목 얻기 (ver 0.2.3,... [14] 메리아 1278 21 10-13
929 소프트웨어| 실컴에서 wim 생성이 실패하는 이유를 찾은 것 같습니다. [7] heykevin 1293 5 01-08
928 소프트웨어| Premiere CS6 강좌 18 녹음,녹음설정방법, Narration설정하... murimgasa 1301 1 11-06
927 소프트웨어| 크롬확장 검색 오류 해결 [3] 내꼬 1303 5 09-04
XE1.11.6 Layout1.4.8