Solved

moving and copying files

Posted on 1998-10-29
2
148 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now