473,608 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Moving multiple files from one folder to another

46 New Member
Hi,

I am using Access to pull in some excel spreadsheets and create tables from them. They appear in one particular subdirectory. However after these spreadsheets are in Access, I'd like to move them all to a new folder. I have been able to code the program to move one - but I need them all to be moved over. Here's what I did:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command59_Click()
  3. Dim fso, f2
  4.  
  5. Set fso = CreateObject("Scripting.FileSystemObject")
  6. Set f2 = fso.GetFile("R:\Projects\ExcelVersion\0012BASE.xls")
  7. f2.Move ("R:\Projects\ProcessedData\")
  8.  
  9. End Sub
  10.  
  11.  
What do I need to do to move all the documents in the folder:
R:\Projects\Exc elVersion\ to folder:
R:\Projects\Pro cessedData\
Apr 22 '09 #1
2 7594
ChipR
1,287 Recognized Expert Top Contributor
You could try out the Application.Fil eSearch and its .FoundFiles property. I haven't used it myself but it goes something like this:
Expand|Select|Wrap|Line Numbers
  1. Dim strFileName as String
  2. With Application.FileSearch
  3.     .LookIn = "C:\My Documents" 'your directory here
  4.     For i = 1 To .FoundFiles.Count
  5.        strFileName = FoundFiles(i)
  6.        'Do Stuff
  7.     Next i
  8. End With
Apr 22 '09 #2
NeoPa
32,566 Recognized Expert Moderator MVP
You could use :
Expand|Select|Wrap|Line Numbers
  1. Call Shell("CMD /C MOVE R:\Projects\ExcelVersion\*.* R:\Projects\ProcessedData\")
This will run asynchronously though (Your code will continue running after the command has been started, and will not wait until it has finished). For a synchronous version see ShellWait() Function.
Apr 23 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
5494
by: Stephen Ghelerter | last post by:
I am moving a web site with a MySql database to another server. Can I create a database on the new server with the same name and then move the tables there, or is life not that simple? Or can I create tables with no data and then replace them with the files from the other server? I know I can export them as text files and them import them, but that is a lot of trouble. Also, using my FTP program I can't access the mysql folder on the...
0
1712
by: Terry | last post by:
I am trying to move a datbase from one machine to another. I have tried two different methods and neither are working. First I tried using : >> mysqldump dbName > backup_file.sql >> mysql dbName < backup_file.sql as the manual outlines, but I have a number of foreign keys resulting in errno=150 because the second command above is trying to restore
9
1572
by: AGoodSpellr | last post by:
Is it possible to use Visual Studio to create ASP.NET projects on a web server, without giving the various people that will be doing this full administrator privliges? Each user will need to have independent folders that they can modify (ie, one user cannot change the contents of another user's folder). Access to the server must be strictly limited for each user (preferably to just adding/removing ASP.NET projects). Having a similar...
6
1904
by: Tim | last post by:
I am in the process of moving a site from one hosting company to another. This site is fairly large, with hundreds of asp files, each with multiple "include" statements. The new host has a different webspace folder structure for it's clients than the old host. At the moment, this is forcing me to have to append all the paths for all the include statements (not to mention all the other path-related code) to make things work. Example:
3
4486
by: Rock2005 | last post by:
Hi All, I have a hard drive that fails to boot with some mysql 4.1 data I would like to keep. Have slaved that drive to another PC (with mysql 4.1.12 loaded) and have saved other data and am able to access its MYSQL folder ... I tried to copy the data folder into corresponding directory on new drive but when I try ot look at any of the databases I get errors like: #1017 - Can't find file: 'master_name.MYI' (errno: 2)
5
10508
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to do this? (IIS 5 or 6 In case you're wondering why I would do this, we have many web sites on a single server, and there are groups of sites that need to share common configuration information. I'd like to ease some administration by having one...
5
3968
by: cybersangeeth | last post by:
Hi, I need to read 1KB each time from multiple files in a folder and pass it to a byte array in a struct to be sent through a socket. I'm a C++ newbie. I managed to read 1KB each time from one file and store it on to another file using the following code. Could anyone please let me know how i could go about reading from multiple files. Thanks in advance. typedef struct {
21
3841
by: Al Christoph | last post by:
I posted this last week end in the MSDN forums. No luck there. Let's see what the experts here have to say:-)))) I have a rather convoluted project. The distributable will come in eight different flavors, each with its main program, libraries, datafiles, doco, etc. Each flavor will also have one or more standalone executables that can be called as tools from within the main program.
1
2657
by: D2 | last post by:
Hi, I have this problem when working with FileSystemWatcher class. I m using one of these objects to watch over a folder. Whenever i big file from another folder to the folder being watched, I get created event and multiple changed events. After the file is copied (fully) i want to read the file and perform some operations on it. Now the issue is, there is no way to find that the file has been copied entirely.
0
8063
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8496
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
6816
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3962
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4024
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1594
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1329
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.