Ok, my mission that I would like to accomplish is to set my program wild on a certain directory. Its mission is to find every mp3 file, rename it to my liking, and organize them(I can handle this myself). I figured the easiest way would be to build an array of all of the directories and subdirectories, and once I finished moving the files in one, move to the next one.
Of course I have some big issues, but I really need some ideas. In my opinion the way I am doing it probably sucks. Here is the code I have been messing with, and it currently does not compile. But hopefully it can show you my idea.
I would like to take any suggestions about changing my approach completely. It seems to me like I am making a fairly simple thing hard.
Code:#include <stdio.h> #include <string.h> #include <windows.h> char* basedir = "C:\\Music\\*"; int main (void) { WIN32_FIND_DATA f; HANDLE h = FindFirstFile(basedir, &f); char* dirs[1000]; char* tempdir; int i = 0; int j = 0; int k = 0; while (h != INVALID_HANDLE_VALUE) { while (FindNextFile(h, &f)) { if (f.dwFileAttributes == 16) { dirs[j] = f.cFileName; j++; } else { //will eventually move the file } } if (j > k) { tempdir = strcat(basedir, dirs[k]); h = FindFirstFile(tempdir, &f); k++; } } return 0; }



LinkBack URL
About LinkBacks



