Search the GP Tables
Search by TABLE NAME
Search by FIELD NAME
These are our SOP scripts. All of our scripts for Dynamics GP can be found here

Table Edits Forum Articles
Table Edits 0 Table Edits 0 Table Edits 0
Sign Up Now!Log In
Points: 50375

4/2/2012 10:45:47 AM

Loop through files in a folder

* This article, and all our great .NET Development documentation, Is available on the .NET Development menu

In writing Dynamics integrations, I'm frequently asked to read a directory of files and process them somehow. Sometimes they're XML, sometimes text. 

This piece of code is the main loop for that task. It's not ground breaking or brilliant; but it saves me 30-60 minutes of coding to have it ready so that I can copy and paste into an app. 

The basic logic is this:

Create 'done' and 'error' folders to move the files into after processing


Process the file

Move the file to 'done'

Trap errors

Move the file to 'error

Handle the error
Version: Unknown or N/A
Section: .NET Development

Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables