메뉴 건너뛰기

XEDITION

UNIX

ex) 디렉토리 구조

/

ㄴ cc

     ㄴ grid

           ㄴ core_11534512

           ㄴ core_15466620

           ㄴ core_19071006

           ㄴ core_22806620

           ㄴ core_28049438

           ㄴ core_8126632

 

 

문제 ) core_15466620 폴더를 제외하고 tar 압축

 

 

 

[nara2@root:/cc]# ls -al
total 8
drwxr-xr-x    3 root     system          256 Oct 17 17:46 .
drwxr-xr-x   43 root     system         4096 Oct 19 16:11 ..
drwxr-xr-x    8 root     system          256 Oct 17 17:45 grid
[nara2@root:/cc]# cd grid
[nara2@root:/cc/grid]# ls -al
total 0
drwxr-xr-x    8 root     system          256 Oct 17 17:45 .
drwxr-xr-x    3 root     system          256 Oct 17 17:46 ..
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_11534512
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_15466620
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_19071006
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_22806620
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_28049438
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_8126632
 

 

[nara2@root:/cc]# ls -al
total 16
drwxr-xr-x    3 root     system          256 Oct 19 16:16 .
drwxr-xr-x   43 root     system         4096 Oct 19 16:11 ..
drwxr-xr-x    8 root     system          256 Oct 17 17:45 grid
-rw-r--r--    1 root     system           21 Oct 19 16:16 xlist               // 파일 및 폴더를 제외하고자 하는 파일을 생성
[nara2@root:/cc]# cat xlist                                                        // 제외할 파일 및 폴더 경로를 정해준다
./grid/core_15466620                                                               // 앞에 .을 꼭 넣어야 함      ./grid/core_15466620

 

 

[nara2@root:/cc]# tar -X xlist -cvf grid.tar ./grid
a ./grid
a ./grid/core_11534512
a ./grid/core_11534512/core 41247 blocks.
a ./grid/core_11534512/coremap.txt 0 blocks.
a ./grid/core_15466620 (excluded)                                               // 제외된 것을 알수 있다.
a ./grid/core_19071006
a ./grid/core_19071006/core 37023 blocks.
a ./grid/core_22806620
a ./grid/core_22806620/core 50256 blocks.
a ./grid/core_28049438
a ./grid/core_28049438/core 28327 blocks.
a ./grid/core_8126632
a ./grid/core_8126632/core 17680 blocks.
[nara2@root:/cc]#
 

 

[tar 압축 푼 결과]

 

[nara2@root:/cc/test/grid]# ls -al
total 0
drwxr-xr-x    7 root     system          256 Oct 17 17:45 .
drwxr-xr-x    3 root     system          256 Oct 19 16:18 ..
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_11534512
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_19071006
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_22806620
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_28049438
drwxr-xr-x    2 root     system          256 Oct 17 17:45 core_8126632

위로