728x90
import os
import shutil
path = "/ssd/crack/data/concretecrack/"
file_lst = os.listdir(path)
print(file_lst)
count=0
num = 83124
for file in file_lst:
if(count < num):
dir = '/ssd/crack/data/val/'
shutil.move(path + file, dir + file)
print(file)
count = count + 1
else:
break
- path = 옮길 파일들이 있는 경로
- num = 옮기고 싶은 파일의 개수
- dir = 파일들이 옮겨질 장소
728x90
'파이썬' 카테고리의 다른 글
[python] 카카오톡 API를 사용하여, 나에게 카카오톡 메시지 보내기 (4) | 2023.10.24 |
---|---|
[AI, python] AI HUB 데이터셋의 어노테이션(Annotation, label)을 darknet format으로 변환하기 (BBOX일 경우) (0) | 2023.08.16 |
[python] txt 파일 읽고 수정하기 (0) | 2023.08.10 |
[python] 폴더에서 jpg 파일만 옮기기 (0) | 2023.08.02 |
[파이썬] 디렉터리마다 파일 n개씩만 다른 폴더로 복사하기 (0) | 2023.04.05 |