7zip 명령이 지정된 출력 디렉터리로 추출되지 않습니다.

7zip 명령이 지정된 출력 디렉터리로 추출되지 않습니다.
7z x d:\migration\mongo\mongodb.7z o:f:\data *.* -r

저는 이 명령을 배치의 일부로 사용하여 한 드라이브(D)에서 다른 드라이브(F)로 7z 파일의 내용을 추출합니다. 폴더 구조가 중요하므로 x재귀적으로 명령을 사용하고 있습니다.

일어날 것으로 예상되는 일은 아카이브 내용이 f:\data.

무엇입니까?실제로 일어나는 일내용이 배치 파일의 작업 디렉터리( f:\migration\)에 압축 해제되는 중입니다. -w:명령에 작업 디렉터리( )를 지정해도 아무런 효과가 없습니다.

명령이 의도한 대로 작동하도록 하려면 어떻게 해야 합니까?

저는 Windows Server 2012 R2에서 7zip x64 9.22b를 사용하고 있습니다.

편집: 내 원래 질문에서는 데이터가 동시에 두 곳으로 추출되고 있다고 언급했습니다. 결과적으로 이것은 사실이 아니었습니다. 이를 반영하여 내 질문이 업데이트되었습니다.

답변1

저는 7za.exe(명령줄 버전)를 사용하고 있지만 7z.exe에서도 마찬가지입니다. 도움말 메시지를 살펴보세요주의하여:

7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a: Add files to archive
  b: Benchmark
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths

<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -ssc[-]: set sensitive case mode
  -ssw: compress shared files
  -t{Type}: Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -v{Size}[b|k|m|g]: Create volumes
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries

스위치가 -o및 이라는 것이 어떻게 명확하게 언급되어 있는지 확인하세요 -w. 마찬가지로하이픈스위치 앞에 있지만 명령 앞에는 없습니다. 또한,콜론~이다~ 아니다스위치 자체의 일부입니다. 그렇다면 단순히 경로로 추출하는 x:대신 유사하게 사용했어야 합니다. 결과적으로 and x의 이상한 사용법이 두통의 원인이 됩니다.o:<Path>w:<Path>

폴더를 재귀적으로 압축하고 상대 경로를 저장하려면 다음과 같은 것을 사용하십시오.

7za a -r Archive.7z C:\InputFolder

특정 디렉토리에 추출하려면 다음을 사용하십시오.

7za x -oD:\OutputFolder Archive.7z

분명히 폴더 이름에 공백이 있으면 큰따옴표를 사용하십시오.

답변2

제 경우에는 CMD에서는 작동했지만 Powershell에서는 작동하지 않았습니다. 대상 디렉토리를 인용하면 문제가 해결되었습니다.

다음은 CMD에서는 작동하지만 Powershell에서는 작동하지 않습니다.

7z x d:\migration\mongo\mongodb.7z -of:\data *.* -r

다음은 두 가지 모두에서 작동합니다.

7z x d:\migration\mongo\mongodb.7z -o"f:\data" *.* -r

관련 정보