Programming

전체 파일 경로에서 파일 이름 찾기

procodes 2020. 6. 18. 22:02
반응형

전체 파일 경로에서 파일 이름 찾기


번거로운 문자열 조작없이 파일 전체 경로 (파일 경로의 일부)에서 파일 이름을 추출하는 방법이 있습니까?

Java와 동등한 기능은 다음과 같습니다.

File f = new File ("C:/some_dir/a")
f.getName() //output a
f.getFullAbsolutePath() //output c:/some_dir/a

사용하다

basename("C:/some_dir/a.ext")
# [1] "a.ext"
dirname("C:/some_dir/a.ext")
# [1] "C:/some_dir"

참고 URL : https://stackoverflow.com/questions/2548815/find-file-name-from-full-file-path

반응형