Link to home
Start Free TrialLog in
Avatar of Rick Rudolph
Rick RudolphFlag for United States of America

asked on

Test for a directory if it doesn't exist create it and move a file into the directory

I have an old VB6 Program that would take a list of files, loop through the list and move the files into subfolders based upon the first 2 characters in the file name. If a corresponding directory did not exist for the first 2 digits the program would create the directory and then move the files.

I am using Visual Basic 2008 Express

So basically I have a subdirectory named c:\ypm with the following files.

pd123.pdf
ap.123.pdf
ap.224.pdf

I want to end up with a subdirectory c:\ypm as follows:

c:\ypm\pd\123.pdf
c:\ypm\ap.123.pdf
c:\ypm\ap.224.pdf
ASKER CERTIFIED SOLUTION
Avatar of dshrivallabh
dshrivallabh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dshrivallabh
dshrivallabh

Note: Above code is not tested ..but the actual version of code must be a similar or a bit modified version of the same.
Avatar of Rick Rudolph

ASKER

Wasn't a complete solution, but gave me enough information to research a total solution.