sh 쉘스크립으로 각 디렉토리에 있는 특정화일을 이름을 바꿀려면..
글쓴이: draco1004 / 작성시간: 화, 2006/12/19 - 10:55오전
/ ----+--cd / tst.toc, tst.toc.utf8
+--csd / hisory.toc, hisory.toc.utf8
+--dvd / rent.toc, rent.toc.utf8
이런 형식( tst.toc.utf8 ) 으로 되어 있는 파일명들을
Ksh 에서 ..
tst.toc
history.toc
rent.toc
로 바꾸어놓을려면 어떻게 해야 하나요 ?
Forums:
한 디렉토리
한 디렉토리 안에서라면.....
for i in *utf8; do mv $i ${i%.*};done
이네요...하지만 여러 디렉토리에 분산되어 있는것은 다른 고수님 께서...
해주세요~~~~
이렇게 해보세요.
대상을 다 포함하는상위 폴더에 가서
설명을 하자면 현재 디렉토리 아래에 있는 파일을 다 찾아서( find . -type f )
for로 돌려서 끝에 .utf8 이 붙는 파일에서 .utf8을 뺀이름으로 바꾼다 ( mv $i ${i%\.utf8} )
${i%\.utf8} 의 의미는 shell문법의 Parameter Substitution을 사용한것으로 다음과 같습니다.
find 옵션에 하나 추가합니다.
find . -type f -name "*utf8"
이름이 utf8로 끝나는 파일만 찾기..
放下着-----
내려놓으려는 마음도 내려놓기
放下着-----
내려놓으려는 마음도 내려놓기
댓글 달기