2017-12-25 10 views
0

스크립트에서 jar xf file을 사용하여 빈 폴더가 포함되어 있지만 빈 폴더가 추출되지 않은 zip 파일의 압축을 풉니 다. jar xf file으로 빈 폴더를 추출 할 수 있습니까?jar xf로 빈 폴더를 추출 할 수 있습니까?

편집 : 실제로 편집자 : 마이크 슬윈이 대답에서 지적한 것처럼 작동합니다. 나는 지금 나 자신에 의해 생성되지 않은 다른 zip 파일을 사용할 때 빈 폴더가 실제로 빈 파일로 변하는 것을 알아 챘다. 그 zip 파일에있는 빈 폴더의 차이점은 무엇입니까? Windows 10 및 JDK 1.8.0_144 64 비트를 사용합니다.

답변

1

예. 증거는 다음과 같습니다.

$ mkdir empty # create an empty directory 

$ jar -cf ~/junk.jar empty ./cache # add the empty directory and other directory to a new jar 

$ jar -tf ~/junk.jar # list the contents of the jar 
META-INF/ 
META-INF/MANIFEST.MF 
empty/ 
cache/ 
cache/ssh/ 
cache/ssh/hostkeys 

$ mkdir blah # make a temporary directory 

$ cd blah # move to the temporary directory 

$ jar -xf ~/junk.jar # extract the jar into the temporary directory 

$ l empty # verify that the "empty" directory exists and is actually empty 
total 8 
drwxrwxr-x 2 mslinn mslinn 4096 Dec 24 19:42 ./ 
drwxrwxr-x 5 mslinn mslinn 4096 Dec 24 19:43 ../ 
+0

감사합니다. 나는 내 질문을 업데이트했다. – stonar96

+0

원하는 경우 내 대답을 수락하고 새로운 질문을하십시오. –

관련 문제