-2

I am a novice in creating automated tasks. I need to create folders based on a file name and move those files into that folder. There are instructions, but I am a little scared to try...little help?

1
  • 2
    Which programming language do you use? What have you tried so far? Commented Jan 4, 2014 at 16:07

1 Answer 1

1

Split this into two steps (assume using C++ in Windows OS):

  1. 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); } 
  2. Write the file to the folder you just created (as you normally do).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.