Windows의 어떤 명령이 Unix의 재귀 이동 / 이름 바꾸기 명령을 에뮬레이트합니까?
답변
XP의 for
명령을 사용하십시오 . 예를 들어 명령 줄에서 (일괄 처리 파일을 사용 %%x
하여) 재귀 이동을 수행하십시오.
for /r %x in (foo) do move "%x" "drive:\path\bar"
재귀 이름 바꾸기를 수행하려면 다음을 수행하십시오.
for /r %x in (*.c) do ren "%x" *.cpp
배치 예 :
for /r "< DIR >" %%x in (*.c) do ren "%%x" *.cpp
답변
robocopy "C:\Source Folder" "C:\Destination Folder" /E /COPYALL /XJ
Description of parameters:
/E - copy subdirectories, including Empty ones (/S to exclude empty ones)
/COPYALL - COPY ALL file info (equivalent to /COPY:DATSOU)
/XJ - eXclude Junction points and symbolic links. (normally included by default).
답변
이동 명령으로 Windows XP SP2 상자에서 작은 예제를 실행하면 효과가 있습니다. 모든 파일과 디렉토리가 소스에서 대상으로 이동되었습니다. source 및 dest는 디렉토리 이름입니다.
소스 이동
ver Microsoft Windows XP [버전 5.1.2600]
이동 /? 파일을 이동하고 파일과 디렉토리의 이름을 바꿉니다. 하나 이상의 파일을 이동하려면 이동 [/ Y | / -Y] [드라이브 :] [경로] 파일 이름 1 [, ...] 대상 디렉토리 이름을 바꾸려면 : 이동 [/ Y | / -Y] [드라이브 :] [경로] dirname1 dirname2 [드라이브 :] [경로] 파일 이름 1 파일의 위치와 이름을 지정합니다 또는 이동하려는 파일. destination Specifies the new location of the file. Destination can consist of a drive letter and colon, a directory name, or a combination. If you are moving only one file, you can also include a filename if you want to rename the file when you move it. [drive:][path]dirname1 Specifies the directory you want to rename. dirname2 Specifies the new name of the directory. /Y Suppresses prompting to confirm you want to overwrite an existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. The switch /Y may be present in the COPYCMD environment variable. 이것은 명령 행에서 / -Y로 대체 될 수 있습니다. 기본은 에서 MOVE 명령을 실행하지 않는 한 덮어 쓰기를 요구하는 프롬프트 배치 스크립트 내에서.
답변
내장 XCOPY 명령이 닫혔습니다. 재귀 복사본을 수행하지만 이름 바꾸기를 지원하지 않는다고 생각합니다.
답변
for /r %%x in (%1) do ren "%%x" %2
이것은 재귀 적으로 파일 이름을 바꿉니다 🙂
파일에 저장하면 확장자에서 확장자까지 2 개의 인수가 제공됩니다.
예 : 파일 이름은 test.bat 명령입니다 : test * .avi * .bmp
확장명이 avi 인 모든 파일의 이름을 bmp (모든 하위 폴더에서)로 바꿉니다.
참고 : 이것은 Rob Kam이 10 월 26 일 13:20에 답변 한 게시물을 수정 한 것입니다. 그는 주었다
/r %x in (*.c) do ren "%x" *.cpp
어디는이 shud로 %% 대신 %
답변
이것은 나를 위해 더 잘 작동했습니다.
FOR /R "C:\folder1\folder2\" %i in (.,*) DO MOVE /Y "%i" "C:\folder1\"
출처 : http://www.islamadel.com/index.php/notes/6-computer/10-windows-command-line