|
-
Apr 24th, 2002, 06:39 AM
#1
Thread Starter
New Member
Dividing large # of files into seprate directories?
I am doing a data conversion and basically I need to seperate a large group of files into smaller groups. Another seperate program (not discussed here) will convert these smaller groups.
The initial files I am working with are over 1 million and are all in one directory. They are all numeric files with 5 to 6 digits each. What I would like to do to improve the performance of the conversion by seperating the 1 million files into less than 1000 in sub directories.
So we would have to scan all the current files in the one directory, then create directories as needed (dynamically). I believe the best way to do this is read the files from right to left. Stopping at the fourth number. Then each number from the fourth # to the far left # would have sub folders created ranging from 0-9 for each number. This would allow each folder to contain less than 1000 files.
Ideally the program would work something like this:
The User push "go" button
There is a pre defined hard coded location of directory with 1 million records.
The program would scan files in directory
The program would read from right to left skip over first three numbers (we want to put less that 1000 records in each folder). Each of the digits, left of the first three number require a sub folder numbered 0-9). Possibly use a dynamic array to save values of dir names.
Make directories based on file names. copy files and place in appropriate numbered directory.
end
Does this make more sense? Or does anyone have ideas on what direction this should take?
sample code is appreciated.
Thanks in advance to anyone who can help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|