-
June 15th, 2012, 06:36 AM
#1
[RESOLVED] How To Move A File From A Folder To Another Folder.
hi
anyone no how to pick up a file in 1 location and put it into a folder in another while deleting the old file in folder
if the files are in different locations
like say a c drive to an f drive
-
June 15th, 2012, 06:54 AM
#2
Re: How To Move A File From A Folder To Another Folder.
Dim FileSystemObject As Object
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
FileSystemObject.CopyFile "c:\file.txt", "H:\file.txt"
-
June 15th, 2012, 08:00 AM
#3
Re: [RESOLVED] How To Move A File From A Folder To Another Folder.
Hmm The thread says resolved but the moethod shown in post 2 will not do what is asked in post 1.
The Vb Function for this is
Code:
Name PathFileName As NewPathFileName
Always use [code][/code] tags when posting code.
-
June 15th, 2012, 08:17 AM
#4
Re: [RESOLVED] How To Move A File From A Folder To Another Folder.
it moves the file from the c to the h driv. i decided to leave out the delete foir now.
do u think its wrong?
it seem to work the moving of it from 1 location to another
-
June 15th, 2012, 11:35 AM
#5
Re: [RESOLVED] How To Move A File From A Folder To Another Folder.
Copy is different than move, copy makes a copy it does not move the original.
A lot of people seem to use FSO anymore, I guess that is what they have learned to use or think it is easier but it really is not the way it should be done. This is an object that was created for scripting and even though it works and can be used in VB, vb has its own methods for doing all these things and they are all faster while using less resources.
In VB CopyFile makes a copy of a file as you have done with the FSO
Name is used to rename or move a file
Always use [code][/code] tags when posting code.
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
|