Creating A Text File That Lists Files And Timestamps
I am copying files from one machine to others and I have a .txt file that I want to list the files that were copied. How would I do that?
Rem write Open "c:update.txt " For Output As #1 Print #1, ???? Close #1
Is there a way to list every file is the folder that I am copying from and write that to the c:update.txt?
Thank You
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Lists && Text Files
How can I make it add a item in a list for each line in a text file.
EX: Text File has:
A new bike
A new motercycle
A new car
Then I want list to read and have:
1st line: a new bike
2nd line: a new motercycle
3rd line: a new car
Accessing Sequential Files With Timestamps In The Filename
How can I code a VB6 program to access a sequential file with a timestamp in its filename?
For example; The name of the file is TSXML-200040415-124944.txt
I will be able to generate the part TSXML-20040415 (that is today's date). However, the timestamp will always change, depending on the time of the day the file was generated. There should at least one file present.
I need to append data to the end of this file without changing the file name.
Thaks for any input provided
Geod
Edited by - geod on 4/15/2004 11:53:18 AM
Need Help Creating A Text File Of Copied Files
I have written a program that copies files from one machine (cpu1) to other machines (cpu2, cpu3, cpu4). I need to write a log on the local machine (cpu1) stating the machine name of the copied to (cpu2) and date as the title of the log. When you open the log it has the files that were copied.
Thanks
Creating One Text File From Existing Files
Hi,
I really need help with this one! There are at least 2 or more batch files but with unknown names. Now, what I need to do is copy all the texts from each and every one of them and save them in one file.
Any help or suggestion would be very much appreciated.
Creating Lists
How can I Create a List of items in VB?
Can i create a struct with data and pointer as in C?
Please help me
Fgpx
Creating Games Lists..
declare player1 and player2
'declare addgame function which adds a new game consisting of the two players' names
Code:
for i = 1 to 18 step 1
'this is going to go through each of the pupils in the yellow house array one at a time
for j = 1 to 18 step 1
'now for each pupil in the yellow array (because this for loop is in side the other one)
'we go through each of the pupils in the green array
if yellow(i,2) != green(j,2) then
'what this is saying is 'is the yellow person in the same class as the green person?
'if not, thats ok! if it is, we skip this part'. that way, we don't get two people with the same class
player1 = yellow(i,1)
player2 = green(j,1)
addgame(player1, player2)
end if
next
next
gamescounter = 0
for i = 1 to 18 step 1
for j = 1 to 18 step 1
if yellow(i,2) != green(j,2) then
gamescounter = gamescounter + 1
games(gamescounter, 1) = yellow(i,1)
'games is array like in spreatsheet of pupils info
games(gamescounter, 2) = green(j,1)
end if
next j
next i
When user clicks on "snap" I want the code above to create a number of lists that gives certain pupils that can play a game.. it's not working!
Any help appreciated
Creating Drop Down Lists
Hi
I am creating an excel file that would have to populate drop down lists based on select criteria.
eg. If we select the country in as USA, drop down list1, then drop down two should be populated with the list of states in USA
How do i do this ? . Any help would be highly appreciated.
Creating Text Files And Saving Text To Them.
This is the best I can find to create a textfile and save a string variable's contents to it. Logically it doesn't make sense to me since you would first need to "create" a file before "opening" it, so either I just don't get it, or this is wrong.
Either way, it's not working, and generates the error: Run-time error '52': Bad file name or number
What am I doing wrong?
CODE'Saves to Text File
Dim strUserText As String
strUserText = "This is a bunch of text to save in a textfile."
Open "c:ProgramLogsLog_" & Date$ & ".log" For Output As #1
Print #1, strUserText
Close #1
Creating Expanding Option Lists
I'm trying to build a option menu for my program.
Basically there is 3 selection types.
Section, within each section are numerous categories, within each category are numerous classes.
They want it setup sorta like a custom install menu is, where you click the lil +box beside one thing, it opens up a droplist of options within that section, with +boxes beside each option, which would open up another list. with checkboxes beside each of the last options, selecting a box within the last list woudl automatically include the section/category ids.
The way each class is determined is by section id, category id, & class id.
Any ideas at all on how to do this? Is it possible?
I'm using VB6, and access 2003, with Crystal reports 8.
Creating Text Files
Is there anyway to check to see if there is already a text file in a certain destination and then if there isnt, create it?
I want to make a high score form for my game. I want the game to check to see if there is a certin file with the name, 1.txt, in (app.path)millionaire and if there isnt create it. How would I do that?
Creating Text Files Within An App
Hey guys, heres my question. Ive got a listbox (list1) which lists all files in a folder selected by a user. I was wondering how to go through the list and for each file, make a corrisponding text file using the same file name. My next question would it be possible to have a template text file so to say and have the app just change the numbers for size in the text file.
Thanks guys for all the help
Dave
Creating Text Files..
This is an easy question just can't remember how to do it. Anyway, all i need to know is how to create a text file in the same directory as the main project.
Thanks to anyone who can help me.
Creating Text Files
Well, I'm not quite that bad, I know how to create text files, but how can I have it check for the files existence? If it doesn't exist, I want it to create it, but if it does already exist I want it to append and not overwrite what's already in the file.
Creating Text Files
Is there a way for VB to create a text file? I know it can open one and write to it, but can it actually create one?
Creating Text Files
ok so this probabally really simple but i just cant remember
how do i make a text file and overwrite any other files of the same name??
Creating Text Files
Hey everyone...I want to create text files with the name based on a field in my other text file. How do I do this?
-----------------------------------------------------------------------------------------------------------------
While Not EOF(fnum)
Input #fnum, observer, thetime, dates, location, northing, easting, species
If observer = "Jim" Or observer = "Bob" Then
Fnum2 = FreeFile
Open "M:" & observer & ".txt" For Input As Fnum2
Write #Fnum2, observer
--------------------------------------------------------------------------------------------------------------------
Thanks
Creating Tab Delimited Text Files
I am trying to put information from a form I have created into a tab delimited text file format. Can anyone help me with this? I can write information to a text file but I can't seem to get it in tab delimited format. Help! This assignment is due Monday!
Creating Delimited Text Files
how do i create a c omma delimited text file from this file. could someone please give me some code using location as an example.
thanks
shann
LOCATION: NW27-1-1E
Owner: WRB
Driller: International Water Supply
Well Name: RM RHINELAND TH #2
Well Use: Test Well
Water Use:
Date Completed: Aug 09, 1971
WELL LOG
From To Log
(ft.) (ft.)
0 14.0 SILT, CLAYEY, LIGHT BROWN
14.0 23.0 CLAY, SILTY, GREY AND BROWN, OXIDIZED
23.0 42.0 CLAY, GREY, SOFT
42.0 145.9 CLAY, GREY, VERY SOFT
145.9 150.9 TILL, GREY, SOFT, GRITTY, COBBLES AND BOULDERS
150.9 157.9 TILL, GREY, GRITTY, HARD, BOULDERS
157.9 163.9 TILL, GREY, SOFTER THAN ABOVE, THIN GRAVEL LAYERS
163.9 164.9 GRAVEL
164.9 171.9 TILL, GREY, HARD, GRAVELLY LAYERS, BOULDERS
171.9 179.9 LIMESTONE GRAVEL AND LIMESTONE BOULDERS, CEMENTED,
LOST CIRCULATION AT 180 FEET
WELL CONSTRUCTION
From To Casing Inside Outside Slot Type Material
(ft.) (ft.) Type Dia.(in) Dia.(in) Size(in)
0 169.9 casing 2.00
169.9 179.9 perforations SL. PIPE
Top of Casing: ft. below ground
PUMPING TEST
Date:
Pumping Rate: 10.0 Imp. gallons/minute
Water level before pumping: ft. below ground
Pumping level at end of test: ft. below ground
Test duration: 1 hours, minutes
Water temperature: ?? degrees F
REMARKS
500 FT S + 80 FT E OF SEC LINE, FILE WRB RHINELAND, HOLE SEALED WITH
6 INCH BY 6 INCH PLUG AND CEMENT ON TOP OF IT, CHEMICAL ANALYSIS
(1971)
_____________________________________________________
Creating Delimited Text Files
I am very new at vb
can someone please give me some code on how to make the following file into a comma delimited file.
could you please use location as an example. i have to parse out the fields to use in access later.
time is of the essence
thanks very much
gus
LOCATION: SE9-1-1E
Owner: JAKE BEUCKERT
Driller: Paddock Drilling Ltd.
Well Name:
Well Use: Production
Water Use: Livestock
Date Completed: Sep 05, 1996
WELL LOG
From To Log
(ft.) (ft.)
0 5.0 CLAY, BLACK TOPSOIL
5.0 10.0 BROWN SILTY CLAY
10.0 15.0 BROWN SILTY SAND, SHELLS
15.0 18.0 VERY FINE BROWN SAND
18.0 25.0 SILTY SANDY GREY CLAY
25.0 30.0 PLASTIC GREY CLAY
WELL CONSTRUCTION
From To Casing Inside Outside Slot Type Material
(ft.) (ft.) Type Dia.(in) Dia.(in) Size(in)
0 9.0 CASING 30.00 CORRUGATED FIBERGLASS
9.0 29.0 PERFORATIONS 0.040 SAW CUT FIBERGLASS
0 29.0 GRAVEL PACK WASHED SAND
Top of Casing: 1.0 ft. above ground
PUMPING TEST
Date: Sep 05, 1996
Pumping Rate: 10.0 Imp. gallons/minute
Water level before pumping: 5.0 ft. below ground
Pumping level at end of test: 26.0 ft. below ground
Test duration: 1 hours, minutes
Water temperature: ?? degrees F
REMARKS
PUMP TEST IS RECOVERY
______________________________________________________________________
Creating Master-Details Lists With The DataGrid Control
At work we are working on a VB6 project to be a front end for our equipment database and chage the status of the item when we sell it. We have two tables, one to store the listings (complete systems) and the other table to hold the individual items of the systems ( parts, accessories) The problem we have is if we sell a system we need to have the description of the system from one table, while if we just sell one part, we just need from the other table the description of that one part. Essentially, if we sold just a part we would use one description, if we sold a system the description field would contain info from the other table. (so i can't directly link a datagrid column with a specific column from a table on the database) I was thinking that a master details list in a datagrid control would be flexible enough to do it. The problem is this, I do not know how to create this master details list. Does anyone has any information on how to do this or has any better ideas of displaying this information? My boss is kinda getting impatient at my lack of results on this 8(
Help: Problem With Creating And Reading Text Files
This problem seems so annoying, because I don't know where I'm going wrong.
I'm making an app that simply creates and reads text files.
Code for my Application
Quote:
Private Sub Form_Load()
'check if file exists
If Dir$("c:pass.txt") <> "" Then
'it exists, so set it as password
strPassword = ReadFile("c:pass.txt")
Else
'if it doesn't, create it
Call WriteFile("c:pass.txt", "clickclick")
'load it to txtGetPass
strPassword = ReadFile("c:pass.txt")
End If
End Sub
Public Sub WriteFile(FileName As String, Contents As String)
Dim i As Integer
i = FreeFile
Open FileName For Output As #i
Print #i, Contents
Close #i
End Sub
Public Function ReadFile(FileName As String) As String
Dim i As Integer
i = FreeFile
On Error GoTo ErrorTrap
Open FileName For Input As #i
ReadFile = Input(LOF(i), i)
Close #i
Exit Function
ErrorTrap:
ReadFile = ""
End Function
This app check if the file FileName exists. If it doesn, great!, it sets it as strPassword. If it doesn't, it creates a file with FileName and Contents, loads it and sets it as password. Simple, right.
Well, here is the problem: Everytime I save "c:pass.txt", with the Content "clickclick", it saves it with a black line after the "clickclick". My text file therefore contains to lines. One with "clickclick", and the other with nothing.
So, when my program loads up "c:pass.txt", it manages to load it up, but it loads it up with the two spaces after, therefore chaning strPassword. This is what strPassword therefore looks like: clickclick -- and then a blank line.
Anyone got a solution to my problem. Any help will be much appreciated. Thank you very much.
Ankur
Creating Form To Export Data To 2 Text Files.
I have access to both VB 6.0 and VB .NET 2002 so help on either is appreciated.
If this is not the place for this question I understand, please just point me to where I should be going.
I do not have a heavy programming background however I have written a very useful VBScript to perform several functions. This script has two text files that it depends on for configuration (ie: a list of files it must remove).
In order to better faciliate the script I want to create a VB form that depending on which check boxes are selected it will populate the two text files required for the script. Additionally I would like the values that it will populate from to be stored in an access database table(s).
#1 How difficult is this going to be with someone of a decent amount of scripting experience but not too much app programming.
#2 Are there any samples out there that I can look at?
#3 Is there an easier way than what I have listed above?
Any help is greatly appreciated.
Thanks again,
Jim
Need Help Creating A .txt File Of Files In A Folder
I am copying files from one central location "C:Documents and SettingsAll UsersDesktopupdates" to the same location on multiple machines dependent on what was selected via option boxes "live and test".and I need to make a .txt file of the files that were copied with whatever text was entered in txtTo.text being the file name of the .txt file. Can anybody give me a hand, I am having a hard time with it.
Code:
Option Explicit
Private Declare Function CopyFile Lib "kernel32" _
Alias "CopyFileA" (ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, ByVal bFailIfExists As Long) _
As Long
Private Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
End Type
Dim txt As String
Dim txt1 As String
Dim txt2 As String
Dim txt3 As String
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Const FO_COPY = &H2
Public Sub SHCopyFile(ByVal from_file As String, ByVal to_file As String)
Dim sh_op As SHFILEOPSTRUCT
With sh_op
.hWnd = 0
.wFunc = FO_COPY
.pFrom = "C:Documents and SettingsAll UsersDesktopupdates*.*"
.pTo = "\" & txtTo.Text & txt
txt3 = "C:Documents and SettingsAll UsersDesktopupdates*.*"
End With
SHFileOperation sh_op
End Sub
Private Sub cmdCopy_Click()
SHCopyFile txt3, txtTo.Text
End Sub
Private Sub Option1_Click()
txt = "LIVEUPDATES"
End Sub
Private Sub Option2_Click()
txt = "TESTUPDATES"
End Sub
Thanks for your help
Creating A File, And Loading Two Files At Once
How would i code the save buttons so it would create a file at the users difined area, and save a text file and a image file as the same name, so it stores the comment/description in a file for each image e.g. image1.jpg would have a file called image1.txt, and then your program just has to read this file when the image is loaded?
*See here for more info about my problem*
Creating And Copying Files Into A .Zip File
Hi,
I want to be able to create a blank zip file and copy a text file into that zip directory. I can create the zip file and I've been trying the FileCopy function without success.
Any help would be much appreciated.
Thanks,
Mike
Vbscript That Lists All Files
Hi,
I need a vbscript that will lists all of the files with a .txt extension in a given directory. COuld anyone please help me by pointing out the command or function that I need. Or any other ideas would help.
Thank You,
Laura
Opening Multiple .asc Files && Creating One .txt File
I am new to Excel VBA and I need some help. I want to create a macro that opens an .asc file which user selects through an input box. I want the macro to then copy a certain range of data from the .asc file and export into a .txt file. After that is done I want it to open another .asc file, do the same thing, but export it to the same .txt file. To explain I have an Infrared machine that splits the large data output into two .asc files. One file has the beginging data, the other has the end data. I want the .txt file to contain the full range. The .asc files have added junk, that is why I only want to export a certain range. **NOTE** the first .asc file will have a different range to export than the second, but I know the exact range of each. When opening an .asc file Excel automatically brings up the "text to columns" box. I want the file to open fixed-width automatically. I probably confused everyone, sorry, but I know someone will have a solution. Thanks in advance....it is much appreciated.
Reading Files In A Folder And Creating .ini File
I dont know if this is possible using FileSystemObject and WritePrivateProfileString, but what I want to do is read ALL the files from a folder (that will contain music files) and place the file names in an .ini file.
For example :
Folder Contains Files : Song1.mp3, Another Song.mp3, Nice Song.mp3
.INI file created :
[Music]
Track1=Song1.mp3
Track2=Another Song.mp3
Track3=Nice Song.mp3
Timestamps
I am using a timestamp to assist with concurrency issues when updating a SQL Server 2000 database with VB6 code. However, when I set up a command object and appropriate parameters to call the stored procedure I use to perform the update, an error is thrown in my VB code when I set the value of the timestamp property. The value I set it to is the value I receive from the database in the form of a disconnected recordset. The error it throws is type mismatch.
Any suggestions gratefully received.
How To Replace Special Characters While Creating Xml File From Text File?
Hi,
In my vb project i am creating xml file from text file by using record set. In my text file if any special characters found like –, . (this is not dot, appearing in the middle of the line) ascii character of that . is 183, xml was not created. it is giving error
Invalid character found.
How can i replace that characters, these two are examples, actually how many are there i don't know.
How can i solve this problem? Any one please help me out.
Thanks in advance
Lalitha.C
Drives, Files And Directory Lists.
Can someone please tell me whats wrong with this code??!!
Option Explicit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub directoryList_Change()
'update file list box to synchronise with the
'directory list box
fileList.Path = directoryList.Path
End Sub
Private Sub driveList_Change()
On Error GoTo DriveHandler
'if new drive was selected, with the directory
'list box
directoryList.Path = driveList.Drive
End Sub
'if there is an error, reset driveList.drive
'with the drive from the directoryList.path
DriveHandler:
driveList.Drive = directoryList.Path
Exit Sub
Private Sub Form_Load()
fileList.Path = CurDir
directoryList.Path = CurDir
driveList.Drive = CurDir
End Sub
Its saying that "Label not defined" and is highlighting the 'On Error GoTo DriveHandler' line of code in the driveList_Change procedure.
This Functions Lists Files, But Not Folders
VB Code:
Private Function AllFiles(ByVal FullPath As String) _ As String() Dim oFs As New FileSystemObjectDim sAns() As StringDim oFolder As FolderDim oFile As FileDim lElement As Long ReDim sAns(0) As StringIf oFs.FolderExists(FullPath) Then Set oFolder = oFs.GetFolder(FullPath) For Each oFile In oFolder.Files lElement = IIf(sAns(0) = "", 0, lElement + 1) ReDim Preserve sAns(lElement) As String sAns(lElement) = oFile.Name NextEnd If AllFiles = sAnsErrHandler: Set oFs = Nothing Set oFolder = Nothing Set oFile = NothingEnd Function Private Sub Form_Load()Dim sFiles() As StringDim lCtr As LongsFiles = AllFiles("C:Documents and SettingsHomeMy Documents")For lCtr = 0 To UBound(sFiles) Debug.Print sFiles(lCtr)NextEnd Sub
Anyone know of a way i can make it lists the folders too, in that direcotry?
Comparing Timestamps
I need to compare two timestamps that will be in this format
"11/11/2004 2:26:44 PM"
Is their a simple compare function that I can use or do I have to compare the dates using cDate() for the dates and then compare the time by seconds -
dSeconds = DateDiff ("s", date1, date2)
Compare Timestamps
Hello !
My question is : how do you compare a time with a value?
Here is what i have:
I take the time Now() minus the time of last modification of a file, and convert this to a date.
This difference (f.e. 10:08:00) i have to compare with an integer value from out of a database (f.e. 15).
This integer has to represent 15 minutes. If the difference between times (10:08:00) is greater then 15 minutes, i have to show a messagebox.
The problem is: how do i convert the integer with value 15 to a time 15 minutes?
Here's what i have of code:
VB Code:
dim int adim fsdim fodim difference Set FS = CreateObject("Scripting.FileSystemObject") Set FO = FS.GetFolder("c: est") a = 15 For Each File In FO.Files difference = CDate((Now() - File.datelastmodified) 'what i want to do: if difference > a then show messagebox 'but i don't know how to convert a to 15 minutesNext Set FO = Nothing Set FS = Nothing
Timestamps In SQLserver??
Hi,all...
May you help me? How to give timestamps in sqlserver, like timestamps in
mysql.
In sqlserver,record in field with timestamps type didn't give date
value.
Thanx
Teddy Cahyono
PT. Toyota Motor Manufacturing Indonesia
General Affairs Division-Building Engineering and TELECOMMUNICATION.
Phone : (021) 6515551 ext. 2328 / 2329
Fax. : (021) 6515327
E-Mail : email@removed
Creating Text File
This should be a simple one for you. This is my first attempt at using a text file of any sort in my program. I wan the user to be able to export the values from my program, so that they can inport it to another program, or copy of the program. I am keeping all my information in an Access 2003 DB, which works fine, but when I go for the export, do I have to use specific code to create the text file, or does the open command automaticly create the file if it does not exist?
I am going to be using the Common dialog control to open/save the files.
Thanks for any help.
Creating A UTF-8 Text File.
I need to create and write strings to a UTF-8 file.
I tried using:
Code:
strMyString = strconv(strMyString, vbUnicode)
print #1, strMyString
Then, I tried creating the utf-8 file manually and then appending to it. But my accented characters still aren't coming out right.
(I'm using vb to process and rearrange the text so I can use it w/ another program.)
Next I tried using adodb:
Code:
Set objStream = CreateObject("ADODB.Stream")
objStream.Charset = "utf-8"
objStream.Open
objStream.Write strMyString
objStream.SaveToFile "C: est.dat"
objStream.Close
But that seems to have created an ANSI file.
Is it possible to do what I want?
Creating A Text File.
Is there a way to just create a plain text file with VB? I don't want the quotes and EOF mark that appear with sequential files or the markings you get with random access, just the plain text from a string, nothing else.
Creating A Text File
I have made a till program that prints a receipt to give to the customer, is there anyway that I can send this receipt to a textfile for the till operator to print and save later???
Creating A .CSV Text File
----------------------------------
1. How can I create a new .txt file in a given folder?
2. How can I insert/add data in it using the CSV format?
3. How can I read the data from the CSV file?
Thanks!
----------------------------------
Creating A Text File....??
Guys,
How would one do the following. I would like to create a text file that stores a bunch of variables when the form is saved. Then if the form is opened again, check for that file and if found, pre-populate the fields. This goes along with the cookie question I had before. Thanks for any thoguhts on this one.
Creating A Text File
I did a search in this forum, but none of them answered my question.
What I am looking for is, once the program runs, it will ask the user to type a text file name, and then it will use the Open "strNameFile" For Input #1
Do I require to create a string in the Sub Main, such as
Public strNameFile As String
Sub Main()
strNameFile = InputBox("Please enter name of text file", "Name required")
Form1.Show
End Sub
I don't know how to get the program to create a text file, but I thought I should use 'CreateTextFile' method? Any suggestions?
Many thanks!
Creating A Text File...
Is it possible to actually create a text file with VB? Let me explain this:
I want to make an Application that is basically a 2 player (some kind of battling) game. The player's can raise levels or some kind of stats, and when a new user comes on, I want the application to actually create a new text file for the newcomer, and place it in a folder with the other characters. Does anyone know how to do this?
Ed
Creating A Text File
Hi all,
I am trying to create a text file in VB, but getting an error ...
User -defned type not defined. suggest me ...
Code:
Private Sub Command1_Click()
Dim FS As New FileSystemObject
Dim Stream As TextStream
Set Stream = FS.CreateTextFile(App.Path & "ashoks.txt", True)
Stream.Close
End Sub
Thanks....
Creating A Text File
I need to create a text file that is named from a text box the user Enters into, then add the text from another text box into that file.
So, for example.
in TextBox1 the user Enters "MyFile"
and in Textbox2 they enter "MyStuff"
It would create a text file named MyFile.txt and have "My Stuff" on the first line of the file, i've looked at some tutorials but they all seem to use an FSO to create a file named by the program itself, and not the user-entered text.
Any help is greatly appreciated.
Help With Creating A Text File.
O.k, I want to save an invoice to a text file, or preferably a word document. Anyone want to give me a little push in the right direction?
Creating A Text File
I have a TextBox and a command button. I want the user to enter a four digit number and press the button. When the button is press i want it to create a text document with the 4 digit number as the name but some informatiob alread inside... like a templeate... is this possible?
|