473,729 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Searching for files and extracting contents

Hi all,
I don't know if this is do-able but you never know until you ask. A
situation at work has arisen where I have to trawl through over 500 text
files, copy the contents and then paste them into an Excel sheet where it is
analysed. Would it be possible to copy the files, paste them into a
'reserved' directory and get Access to import the contents of all the file
in one go? The first line and last line of these text files would need to be
ignored. Other than that, the contents of each file is laid out in exactly
the same format and will not change.

Any help on this would be great,

Many thanks,

Mark
Nov 13 '05 #1
2 1531
I have found some code which I am trying to use but can't get it to work.
Can anyone tell me where I am going wrong?

Private Sub Command0_Click( )
'procedure to import all files in a directory and delete them.
'assumes they are all the correct format for an ASCII delimited import.
Dim strfile As String

ChDir ("C:\Documen ts and Settings\Mark\M y Documents\Datab ase
work\Workstuff\ Files_to_import \")
strfile = Dir("rec*.*")
Do While Len(strfile) > 0
DoCmd.TransferT ext acImportFixed, "Standard Output", "Table1",
"C:\Documen ts and Settings\Mark\M y Documents\Datab ase
work\Workstuff\ Files_to_import " & strfile, True
'delete the file (consider moving it to an Archive folder instead.)
Kill "C:\Documen ts and Settings\Mark\M y Documents\Datab ase
work\Workstuff\ Files_to_import \" & strfile
strfile = Dir
Loop

End Sub

Thanks all,
Mark

"Mark Reed" <ma*********@nt lworld.com> wrote in message
news:GO7Fc.30$% A3.10@newsfe5-win...
Hi all,
I don't know if this is do-able but you never know until you ask. A
situation at work has arisen where I have to trawl through over 500 text
files, copy the contents and then paste them into an Excel sheet where it is analysed. Would it be possible to copy the files, paste them into a
'reserved' directory and get Access to import the contents of all the file
in one go? The first line and last line of these text files would need to be ignored. Other than that, the contents of each file is laid out in exactly
the same format and will not change.

Any help on this would be great,

Many thanks,

Mark

Nov 13 '05 #2
"Mark Reed" <ma*********@nt lworld.com> wrote in message news:<GO7Fc.30$ %A3.10@newsfe5-win>...
Hi all,
I don't know if this is do-able but you never know until you ask. A
situation at work has arisen where I have to trawl through over 500 text
files, copy the contents and then paste them into an Excel sheet where it is
analysed. Would it be possible to copy the files, paste them into a
'reserved' directory and get Access to import the contents of all the file
in one go? The first line and last line of these text files would need to be
ignored. Other than that, the contents of each file is laid out in exactly
the same format and will not change.

Any help on this would be great,

Many thanks,

Mark


As you noted, use Dir() to loop through the contents of the directory,
FileCopy to copy the file to a specific location...
If the first line and last line of the text files are easily
identifiable, you could delete those records with a query. Otherwise,
you'll have to open the file, read the contents a line at a time and
process them that way.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2531
by: John | last post by:
Hi everyone ! This is a first time I post a message here. If I post my message in a wrong group. Please ignore it. I am trying to build a website which allows users (can be thousands of users, supposedly) to upload their files to their designaged directories (max 15 files for each user). A super user (can be more than one) want to search for a particular file name and also a particular textual part of a file of all user's files in all...
1
1769
by: Derek Mortimer | last post by:
This is my first attempt to join a user group. I run an iMac and have recently upgraded to OSX, OfficeX, after years of problems. I am having difficulties with Find, or maybe do not understand its function. I frequently want to find by content, eg, want to look at all the files and downloads which include the word 'war'. If I put 'war' into the 'contents includes' box I get a list of files. Some include the word 'war,' some do not...
1
10349
by: Aladdin | last post by:
I am using the java.util.zip package to create zip files. I can create a new archive and add files to it without any trouble. But if I already have a zip file created, how do I add a new file to the archive without impacting the existing files? I looked through the APIs with no luck. I would rather avoid extracting all the files and rebuilding the archive from scratch if at all possible. Thanks -M
2
1717
by: Greg Lindstrom | last post by:
I've been zipping up files for months with zipfile, but today I was asked to extract the contents of a zip file and was sure there would be an "extract" method...but there's not one that I can find! Am I just missing something?? I found a module, unzip.py, on Parnassus, but it doesn't work. Does anyone have a way for me to extract files? Thanks! Greg Lindstrom (501) 975-4859 NovaSys Health ...
2
2538
by: Avi | last post by:
hi, Can anyone tell me what the problem is and how to solve it The following piece of code resides on an asp page on the server and is used to download files from the server to the machine accessing the abobe mentioned asp page. It WORKS for every type of file when I change the content type according to the file type, but it won't work with self extracting files. When an end user downloads a self extracting file by accessing the...
4
1542
by: Qwert | last post by:
Hello, is there a way to combine multiple files into 1 file with VB.NET? Example: Dim MyList As New ArrayList() MyList.Add("File1.txt") MyList.Add("File2.doc") Pack(MyList , "AllMyFiles.dat") ....
2
1745
by: Chris Murphy via DotNetMonster.com | last post by:
Hey all, just wondering if anyone can point me in the right direction. I'm developing a solution that allows a user to store multiple text-based content (like code snippets, notes, documents etc.) in one master document. I'm not exactly sure which is the most efficient method of going about this. Should I: a. Use a container file like a CAB file and read/write separate textfiles to it? b. Save all "documents" in a collection and serialize...
6
5032
by: reidarT | last post by:
I will develop a backup routine with local files (zipped) to an internet server via ftp. How do I zip files in Vb.net? reidarT
2
1992
by: avik1612 | last post by:
hi, I have created a script in perl to extract n number of zip files to a particular destination after creating the folder of the zip file. It is extracting . But when the zip file has subdirectories or folders inside it it ignores that and eztracts the whole contents without making folders what shout it do I am using activeperl in Windows XP i have pasted the code
0
8921
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
9427
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...
1
9202
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
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
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
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.