Ben's

mv --strip-trailing-slashes 옵션 소개 본문

리눅스

mv --strip-trailing-slashes 옵션 소개

Ben Ko (SINCE 2013) 2013. 4. 5. 14:37
728x90

       --strip-trailing-slashes remove any trailing slashes from each SOURCE
              argument

================================================

★ --strip-trailing-slashes 옵션 미사용시: txt를 디렉토리로 인식하여 링크 걸린 /하위 파일들을 /home/test1 아래로 move 시켜버림(심각한 문제 발생!!)

[root@pdns-test03 test]# mkdir /home/test1

[root@pdns-test03 test]# pwd
/root/test

[root@pdns-test03 test]# ls
txt@

[root@pdns-test03 test]# mv -v txt/ /home/test1
`txt/' -> `/home/test1/txt'
`txt/disk2' -> `/home/test1/txt/disk2'
`txt/dev' -> `/home/test1/txt/dev'
`txt/dev/vcs6' -> `/home/test1/txt/dev/vcs6'
`txt/dev/vcsa4' -> `/home/test1/txt/dev/vcsa4'
`txt/dev/vcs4' -> `/home/test1/txt/dev/vcs4'
`txt/dev/vcsa5' -> `/home/test1/txt/dev/vcsa5'
`txt/dev/vcsa6' -> `/home/test1/txt/dev/vcsa6'
`txt/dev/vcs5' -> `/home/test1/txt/dev/vcs5'
`txt/dev/vcs3' -> `/home/test1/txt/dev/vcs3'
`txt/dev/vcsa2' -> `/home/test1/txt/dev/vcsa2'
`txt/dev/vcs2' -> `/home/test1/txt/dev/vcs2'
...


★ --strip-trailing-slashes 옵션 사용시: txt를 /를 뺀 파일로 인식하여 /home/test2 아래로 링크 그대로 move 시킴.(안전함)

[root@pdns-test03 test]# mkdir -p /home/test2

[root@pdns-test03 test]# mv -v  --strip-trailing-slashes txt/ /home/test2
`txt' -> `/home/test2/txt'
removed `txt'

[root@pdns-test03 test]# ls /home/test2
txt@

'리눅스' 카테고리의 다른 글

thttpd config  (0) 2013.04.16
rm --preserve-root 옵션 소개  (0) 2013.04.08
성능 튜닝  (0) 2013.01.21
lsyncd(실시간 파일 동기화)  (0) 2013.01.21
vim에서 윈도 개행문자(^M) 삭제하기  (0) 2013.01.21