create directory

hi is there a way to create a directory form C/AL without using the shell command.?

I tried to insert a record in a file record, but that didn’t work. Witch is nice… So I don’t think it’s possible using only Navision functionality. But why not use shell?

Hi If you can use automation try the server ‘Microsoft Shell Controls And Automation’.Folder. There is a method ‘NewFolder’ (didn’t test it) . bye André

Or you can use the automation server “Microsoft Scripting Runtime”.“FileSystemObject” or *.“Folder” or *.“Folders”. In “FileSystemObject” you have really usefil functions/methods: FileSystemObject.BuildPath FileSystemObject.GetDriveName FileSystemObject.GetParentFolderName FileSystemObject.GetFileName FileSystemObject.GetBaseName FileSystemObject.GetExtensionName FileSystemObject.GetAbsolutePathName FileSystemObject.GetTempName FileSystemObject.DriveExists FileSystemObject.FileExists FileSystemObject.FolderExists FileSystemObject.GetDrive FileSystemObject.GetFile FileSystemObject.GetFolder FileSystemObject.GetSpecialFolder FileSystemObject.DeleteFile FileSystemObject.DeleteFolder FileSystemObject.MoveFile FileSystemObject.MoveFolder FileSystemObject.CopyFile FileSystemObject.CopyFolder FileSystemObject.CreateFolder FileSystemObject.CreateTextFile FileSystemObject.OpenTextFile FileSystemObject.GetStandardStream FileSystemObject.GetFileVersion You don’t need the shell anymore. Regards Walter

I use following program lines to test,it popup error message show “automation has not instatiated” IF NOT filesystem2.FolderExists(‘c:\temp’) THEN filesystem2.CreateFolder(‘c:\temp’); how to instantiated the automation?

quote:


Originally posted by peterxiong
I use following program lines to test,it popup error message show “automation has not instatiated” IF NOT filesystem2.FolderExists(‘c:\temp’) THEN filesystem2.CreateFolder(‘c:\temp’); how to instantiated the automation?


This should do the job: clear(filesystem2); if create(filesystem2,True) then; ... YourAction ... bye André

Hi,Andr, the test is success,the function very useful. thank you all