|
-
Sep 11th, 2000, 03:26 AM
#1
Thread Starter
Addicted Member
Is there any way of opening a FOLDER for append.
Something like:
Code:
Open "Pathname/foldername" for Append
I want to move files from one folder to another without deleting any files in the target folder.
-
Sep 11th, 2000, 03:56 AM
#2
_______
<?>
[copy]
'copy the contents of a floppy to a folder on a different drive
'copies files and folders seperately as they use different vehicles
'
Public Sub CopyA()
Dim FSO As Object
On Error GoTo NOFSO
Set FSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
FSO.CopyFile "A:\*", "C:\My Documents\", True
FSO.CopyFolder "A:\*", "C:\My Documents\", True
Set FSO = Nothing
Exit Sub
NOFSO:
MsgBox "FSO CreateObject Failed"
End Sub
[/code]
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 11th, 2000, 04:02 AM
#3
Thread Starter
Addicted Member
Is there any way to delete the origional files after the files have been copied. Like a MoveFile instead of CopyFile????
-
Sep 11th, 2000, 03:22 PM
#4
I don't think there is a way to move files using VB Code. You'd have to use the FileCopy and Kill statements. And if the files are the same name, I think they will be overwritten automatically.
-
Sep 11th, 2000, 03:40 PM
#5
Thread Starter
Addicted Member
Thanks for the help guys,
How would I go about using KILL? If I put it straight after the fileCopy, will that work?
Thanks again
JK
-
Sep 11th, 2000, 03:52 PM
#6
Are you saying you want to copy the file and then delete the file you copied since it doesn't move itself?
Copy the file first:
Code:
FileCopy "C:\Myfile.txt", C:\MyProgram\Myfile.txt"
And then delete the file:
Code:
Kill "C:\Myfile.txt"
-
Sep 12th, 2000, 03:29 AM
#7
Thread Starter
Addicted Member
Yes that's it. The only problem that I have is that I don't know the name of the file. It's all based on the file extension. I want to copy all files in the folder with a file extension of .htm and leave all other files with different file extensions in the folder. Any ideas?
Code:
Private Sub Timer1_Timer()
Call CopyA
End Sub
Public Sub CopyA()
Dim FSO As Object
On Error GoTo NOFSO
Set FSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
FSO.CopyFile "C:\Documentation\*.htm", "C:\Test\", True
FSO.Kill "C:\Documentation\*.htm"
Set FSO = Nothing
Exit Sub
NOFSO:
MsgBox "FSO CreateObject Failed"
End Sub
All the files are copied to the folder ok, but they won't delete from the original folder. Any Suggestions
[Edited by kanejone on 09-12-2000 at 05:11 AM]
-
Sep 12th, 2000, 10:26 AM
#8
Thread Starter
Addicted Member
Another question if possible. The folder that I'm putting the files into is actually going to be generated just before I do the FileCopy. This is how the folder name is going to be generated.
Code:
Private Function MakeFolder(NewDir As String)
Dim dirname As String
dirname = "C:\Documentation JK\"
NewDir = dirname & NewDir
MkDir NewDir
End Function
Private Sub Archive_Click()
today = Format(Now, "dd mmmm yyyy")
MakeFolder (today)
Call CopyA
End Sub
So what I need to do is something like this:
Code:
FSO.CopyFile "C:\Documentation\*.htm", "C:\Test\MAKEFOLDER(today)", True
Is there any way to do this???
Thanks for the time you've taken, I really to appreciate it
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
|