강좌 / 팁

소프트웨어 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 - - -
4281 윈 도 우| NTP 서버&클라이언트 설정 하기 (윈도우 시간 동기화) [5] 무월 1171 7 06-03
4280 윈 도 우| PNG_ICO (이미지 아이콘 변환) [7] 슈머슈마 1171 6 11-12
4279 소프트웨어| 영상이름에 자막 매치시키기 오토핫키 [8] 비려막존 1173 8 04-27
4278 모 바 일| 카톡에서 사진 보내는 자세한 방법에 대한 설명을 요청하신... murimgasa 1174 1 08-13
4277 소프트웨어| 기상 정보-Forecastfox - Firefox+Google Chrome용 부가 기능 [3] VenusGirl 1175 9 12-31
4276 소프트웨어| Adobe Premiere CS6 강좌 유용한 팀Tip 몇가지 -복사단축키... [1] murimgasa 1177 1 08-25
» 소프트웨어| Total commander 에서 검색된 파일들을 폴더 구조와 함께 ... [8] 줄리아니 1177 6 03-22
4274 모 바 일| 카톡에서 다국어를 쉽게 입력하는 방법 [1] 무림거사 1180 3 03-01
4273 윈 도 우| 가장간단한 ToggleTaskbar(수정) [7] 레마클로 1181 5 02-29
4272 모 바 일| *Kinemaster강좌. 동영상에서 음악만 추출하는 방법, murimgasa 1188 1 09-16
4271 소프트웨어| 팁: VirtualBox 7의 Windows 10/11에서 NVMe 드라이버 활성... [3] VᴇɴᴜꜱGɪ 1188 9 03-05
4270 윈 도 우| Move over there 우메뉴등록_제거 + 그룹정책 백복 [10] 레마클로 1191 11 03-25
4269 소프트웨어| command prompt 에서 메일 보내기 [5] shot4u 1192 4 12-17
4268 소프트웨어| 마우스 두개 양손 사용시 왼손 마우스 버튼 스왑 [7] 지후빠 1194 12 12-24
4267 소프트웨어| Win10XPE - Desktop.INI 삭제 과정 안 보이게 하기. [3] 입니다 1195 8 07-19
4266 윈 도 우| ISO 마운트 - 작업 - 꺼내기, ISO2WIM 추출 [5] 지후빠 1195 20 12-04
4265 모 바 일| *Kinemaster 강좌,키네마스터 영상합성 마스크 기법- 동영... murimgasa 1204 1 12-11
4264 소프트웨어| 중국어 프로그램 한글화 팁 [8] 줄리아니 1205 16 08-14
4263 윈 도 우| (수정5) 윈도우 버전구분 배치파일 [4] 메리아 1207 14 03-23
4262 소프트웨어| 다중 웹 검색 - Firefox 및 Chrome 부가 기능 [1] VenusGirl 1209 3 05-22
XE1.11.6 Layout1.4.8