|
-
Nov 14th, 2000, 01:11 PM
#1
Thread Starter
Lively Member
I have an application that opens a text file that it recieves daily via ftp. It appends all of the data in the text file to a SQL7 db and then closes the db connection. I then need the program to move the file to a different folder and rename it with a new file name. What code can I use to handle the moving and renaming?
-
Nov 14th, 2000, 01:16 PM
#2
Addicted Member
Answer
Very easy
FileCopy "Drive:\folder\file.ext", "NewDrive:\folder\newfile.ext"
You can use that to copy the file, it will also rename it if you type a different filename.
But, so you know to rename a file use:
Name "oldfilename.ext" As "newfilename.ext"
Matthew
-
Nov 14th, 2000, 01:20 PM
#3
Thread Starter
Lively Member
How could I then delete the old file?
How could I then delete the old file as it can not exist when a file with the same name is ftped to the directory again the next day?
-
Nov 14th, 2000, 01:22 PM
#4
Lively Member
-
Nov 14th, 2000, 01:22 PM
#5
Fanatic Member
Originally posted by VBDever
I have an application that opens a text file that it recieves daily via ftp. It appends all of the data in the text file to a SQL7 db and then closes the db connection. I then need the program to move the file to a different folder and rename it with a new file name. What code can I use to handle the moving and renaming?
Hi,
There is a FileCopy Statement.
Syntax: FileCopy source, destination
source : Rquired. STRING Expression specifies the name of the file to be copied. May include directory or folder, and drive.
destination: Required. String Expression specifies the target file name. May include directory, folder, and drive.
Remarks.
If you try to use the FileCopy statement on a currently open
file, an error occurs.
EXAMPLE
[code]
Dim SourceFile, DestinationFile
SourceFile = "C:\TEMP\SRCFILE"
DestinationFile= "C:\TEMP2\DESTFILE"
FileCopy SourceFile,DestinationFile
Cheers
ray
-
Nov 14th, 2000, 01:23 PM
#6
Lively Member
sorry
kill "c:\tttt.txt"
it deletes the file perfectly
good luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|