arrays - C# How to iterate through a list of files without using Directory.GetFiles() method -


i have several security cameras upload pictures ftp server. of these cams conveniently create subfolders @ start of new day in format "yyyymmdd". great , makes easy maintain/delete older pictures particular day. other cams aren't nice , dump pictures in giant folder, making deletion difficult.

so writing c# windows form program go specific folder (source folder) using folderbrowserdialog , name target folder using fbd. using standard process iterate through file list using string array filled via directory.getfiles() method. use file's creation date create subfolder if doesn't exist. in either case move file date based subfolder. works great while testing small numbers of files.

now i'm ready test against real data , i'm concerned folders having thousands of files, i'm going have many issues memory , other problems. how can string array handle such huge volumes of data? note 1 folder has on 28,000 pictures. can string array handle such large number of fileinfo objects?

my question how can iterate through list of files in given folder without having use string array , directory.getfiles() method? i'm open thoughts though want use c# in windows form environment. have added feature lets me delete pictures older given date instead of moving them.

many thanks!

you'll fine thousands of file names. might have problem millions, thousands isn't big deal c#. may have performance issue because of how ntfs works, if there's nothing can in c#; it's problem inherent in file system.

however, if want pick @ this, can little better using directory.enumeratefilesysteminfos(). method has 2 benefits on getfiles():

  1. it loads file name , creation date in 1 disk access, instead of two.
  2. it allows work ienumerable instead of array, such need memory 1 file record @ time.

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -