Solved

moving and copying files

Posted on 1998-10-29
2
150 Views
Last Modified: 2010-05-18
I am writing a short little program to move/copy files from one workstation to another and I have several questions that I have to get answered. The first is:
1. How do I get just the path from a common dialog open? I like the way it looks and the fact that you do not have to map a network drive beforehand.
2. How do I scan for files? I would like to be able to move/copy all files that match a certain criteria (say *.log or *.doc) and then write to a log that I moved/copied so an so.
3. How do I scan all sub directories(for question 2)
4. How do I tell if a file is in use/open?
Any help would be appreciated.
If you need more info, contact me at cliffm@tidalwave.net
0
Comment
Question by:cliff_m
2 Comments
 
LVL 2

Accepted Solution

by:
shchuka earned 100 total points
ID: 1442350
1. you cannot use the file open dialog box to get the directory name alone - you need a file to be selected in it, then you can actually get the directory from that file.  If your problem is in mapping network drives from your program, I can send you some pieces of code that do that.

2. use function Dir of VB look for it in the help - it does what you want.

3. Again, use Dir function. You will need to write a recursive function which would scan for the directories, since you need to traverse all subdirectories.

4. There are several methods.  One is to try to open the file for reading - and trap errors.  One of the possible errors is 'permission denied'.

These should get you started,
-Aleks.
0
 

Author Comment

by:cliff_m
ID: 1442351
Can you give me some code sample for mapping network drive for problem 1? the rest of it looks like it will work.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question