Options

Iterate through directory NAS

rickyl76rickyl76 Member Posts: 25
edited 2017-03-14 in NAV Three Tier
I have a process where I need to loop through a directory specified on the network and import all the files data. If I run it through the client all is fine using the DirectoryInfo.GetFiles code. However, running it through NAS I get the client callbacks are not supported error. I know why I am getting this error but am struggling to find a resolution. Can anyone help?

Answers

  • Options
    ErictPErictP Member Posts: 164
    In NAV2016 look in CodeUnit 419:
    FileManagement@1100537000 : Codeunit 419;
    NameValueBuffer@1100537001 : TEMPORARY Record 823;
    
    FileManagement.GetServerDirectoryFilesList( NameValueBuffer, '//server/path');
    IF NOT NameValueBuffer.ISEMPTY THEN
    	IF NameValueBuffer.FINDSET THEN
    		REPEAT
    			// DO your stuff WITH Path+NameValueBuffer.Name
    		UNTIL NameValueBuffer.NEXT = 0;
    
    
  • Options
    rickyl76rickyl76 Member Posts: 25
    Thanks for your reply ErictP. I have this working fine now but just want to confirm that should I put the files in a network location and not on the local disk the NAS will be able to see the directory and I won't need to do any uploading and downloading? Also if I want to move the file after processing I can just use the FILE.COPY without calling the moveandrename in File management?
Sign In or Register to comment.