I am starting to create automated tasks. I need to create folders based on the file name and move these files to this folder. There are instructions, but I'm a little afraid to try ... help a little?
Divide this into two steps (suppose using C++ on a Windows OS):
C++
Windows
Create a folder.
#include <Windows.h> void create_folder(char* Path) { char DirName[256]; char* p = Path; char* q = DirName; while(*p) { if (('\\' == *p) || ('/' == *p)) { if (':' != *(p-1)) { CreateDirectory(DirName, NULL); } } *q++ = *p++; *q = '\0'; } CreateDirectory(DirName, NULL); }
Write the file to the newly created folder (as usual).