728x90

파일 3

[파이썬] 디렉터리마다 파일 n개씩만 다른 폴더로 복사하기

import os import shutil import natsort as natsort NAME_PATH = os.path.join(os.getcwd() + '/training/') IMG_PATH = os.path.join(os.getcwd() + '/target/') PATH = os.getcwd() count = 0 one = os.listdir(IMG_PATH) one = natsort.natsorted(one) for i in one: two = natsort.natsorted(os.listdir(os.path.join(os.getcwd() + '/target/'+i+"/"))) for j in two: three = natsort.natsorted(os.listdir(os.path.join(..

파이썬 2023.04.05

[c#] ftp에서 불러온 파일을 저장할 때, 같은 이름의 파일이 있을 경우 넘버링(숫자) 해주기

//저장할 파일이름을 이미 포함하고 있다면 넘버링 foreach (FileInfo File in di.GetFiles()) { String FullFileName = File.FullName; if (FullFileName.Contains(logName + "(" + fileCount + ")")) { fileCount++; } } saveFileDialog.InitialDirectory = filePath; saveFileDialog.Title = "저장 경로를 지정하세요."; saveFileDialog.FileName = logName + "(" + fileCount + ")"; fileCount = 0; FileInfo File in di.GetFiles() foreach문으로 현재 디렉토리의 모든..

c# 2023.03.29

[c#] FTP에서 디렉토리(Directory)와 파일(File) 불러오기

💡 디렉토리와 파일을 구분하는 방법? 불러온 주소를 다시 덧붙여서 하위 디렉토리가 있는지 검사 → 하위 파일이나 디렉토리가 없는 경우, 검사하기 어려움 파일 접근 권한에 ‘d’가 붙은 지 검사 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace loadingFtp { internal class Class1 { public static void Main(String[] args) { Uri ftpUri = ..

c# 2023.03.21
728x90