C
Chad
I am receiving the following two errors in the code below. Both are
on Line 56.
error C2039: 'CreateDirectoryA' : is not a member of
'System::IO:irectory'
error C2660: 'CreateDirectoryA' : function does not take 1 arguments
Could anyone please point me in thr right direction?
Thanks!
----------------------------------------------------------
#include <windows.h>
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
#include "main.h"
int main() {
bool endlessLoop = true;
// Drive G: should be mapped to \\Dri-sql-mail2\G_share
String* strOldPath = "g:\\DRI\\scanner\\FinalPoliciesTemp";
String* strNewPath =
"g:\\inetpub\\wwwroot\\Documents\\Completed Deeds & Docs";
// Program will run indefinitely
while(endlessLoop) {
// load a string array with a list of all of the
directories
String* strDirectoryEntries[] =
Directory::GetFileSystemEntries(strOldPath);
// loop through that array and move each directory
for(int i=0;i<strDirectoryEntries->Length;i++) {
// The current time plus five minutes
DateTime dtNow = DateTime::Now;
dtNow = dtNow.AddMinutes(5.0);
// The time the file was last modified
DateTime dtThisFile =
File::GetLastWriteTime(strDirectoryEntries);
// if the file's Last Modified time is greater
than the current time (plus 5 minutes)
// then we move the file.
if (DateTime::Compare(dtNow, dtThisFile) >= 0)
{
// Grab the order number from the full
path.
String* strBeginningOfOrderNumber =
"\\";
String* strEndOfOrderNumber = ".";
String* strOrderNumber =
strDirectoryEntries->Substring(strDirectoryEntries->LastIndexOf(strBeginningOfOrderNumber)+1,((strDirectoryEntries->Length)-(strDirectoryEntries->LastIndexOf(strEndOfOrderNumber)+1)));
// Grab the filename from the full
path.
String* strFileName =
String::Concat(strOrderNumber,".tiff");
String* strTempNewPath =
String::Concat(strNewPath,"\\");
strTempNewPath =
String::Concat(strTempNewPath,strOrderNumber);
// if the directory does NOT exist,
then create it
if(!Directory::Exists(strTempNewPath))
{
Directory::CreateDirectory(strTempNewPath);
}
strTempNewPath =
String::Concat(strTempNewPath,"\\");
strTempNewPath =
String::Concat(strTempNewPath,strOrderNumber);
// move the file
File::Move(strDirectoryEntries,strTempNewPath);
}
Console::WriteLine(String::Concat(strDirectoryEntries," moved!"));
}
Console::WriteLine("*** Do NOT close this Window!
***");
// Wait 3 minutes before next iteration
// 3m = 180s = 180,000ms
Sleep(180000);
}
return 0;
}
on Line 56.
error C2039: 'CreateDirectoryA' : is not a member of
'System::IO:irectory'
error C2660: 'CreateDirectoryA' : function does not take 1 arguments
Could anyone please point me in thr right direction?
Thanks!
----------------------------------------------------------
#include <windows.h>
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
#include "main.h"
int main() {
bool endlessLoop = true;
// Drive G: should be mapped to \\Dri-sql-mail2\G_share
String* strOldPath = "g:\\DRI\\scanner\\FinalPoliciesTemp";
String* strNewPath =
"g:\\inetpub\\wwwroot\\Documents\\Completed Deeds & Docs";
// Program will run indefinitely
while(endlessLoop) {
// load a string array with a list of all of the
directories
String* strDirectoryEntries[] =
Directory::GetFileSystemEntries(strOldPath);
// loop through that array and move each directory
for(int i=0;i<strDirectoryEntries->Length;i++) {
// The current time plus five minutes
DateTime dtNow = DateTime::Now;
dtNow = dtNow.AddMinutes(5.0);
// The time the file was last modified
DateTime dtThisFile =
File::GetLastWriteTime(strDirectoryEntries);
// if the file's Last Modified time is greater
than the current time (plus 5 minutes)
// then we move the file.
if (DateTime::Compare(dtNow, dtThisFile) >= 0)
{
// Grab the order number from the full
path.
String* strBeginningOfOrderNumber =
"\\";
String* strEndOfOrderNumber = ".";
String* strOrderNumber =
strDirectoryEntries->Substring(strDirectoryEntries->LastIndexOf(strBeginningOfOrderNumber)+1,((strDirectoryEntries->Length)-(strDirectoryEntries->LastIndexOf(strEndOfOrderNumber)+1)));
// Grab the filename from the full
path.
String* strFileName =
String::Concat(strOrderNumber,".tiff");
String* strTempNewPath =
String::Concat(strNewPath,"\\");
strTempNewPath =
String::Concat(strTempNewPath,strOrderNumber);
// if the directory does NOT exist,
then create it
if(!Directory::Exists(strTempNewPath))
{
Directory::CreateDirectory(strTempNewPath);
}
strTempNewPath =
String::Concat(strTempNewPath,"\\");
strTempNewPath =
String::Concat(strTempNewPath,strOrderNumber);
// move the file
File::Move(strDirectoryEntries,strTempNewPath);
}
Console::WriteLine(String::Concat(strDirectoryEntries," moved!"));
}
Console::WriteLine("*** Do NOT close this Window!
***");
// Wait 3 minutes before next iteration
// 3m = 180s = 180,000ms
Sleep(180000);
}
return 0;
}