Solved

Urgent (but simple) FileSystemObject Question

Posted on 2006-06-28
5
163 Views
Last Modified: 2012-05-05
Dim m_fso As FileSystemObject
Dim CFile As File, NFile As File, CFileStr As String, NFileStr As String, IFileindex As Long, CopyStatus As Long

Set m_fso = New FileSystemObject

''''''''
' I have 2 list boxes with 3000 filenames and paths in each, dont worry about the finer details of it!
''''''''
CFileStr = LstCFileList.List(IFileindex)
NFileList = LstNFileList.List(IFileindex)

If m_fso.FileExists(CFileStr) Then
   Set CFile = m_fso.GetFile(CFileStr)
   Set NFile = m_fso.GetFile(NFileStr)
           If CFile.Size <> NFile.Size Then
                CopyStatus = 1
            End If
'''''
' More comparissons between NFile and CFile, if an inconsistency is found, copystatus is also set to 1
'''''  
    If CopyStatus = 1 Then
        m_fso.CopyFile NFile, CFile, True
End If

-----------------------------------------------------

The Files Wont copy and I'm not sure of the correct syntax.

PLS PLS PLS correct my code.  If you need any more code snippets, let me know.


0
Comment
Question by:NAORC
  • 2
  • 2
5 Comments
 
LVL 5

Author Comment

by:NAORC
ID: 17000136
*by the way, this is all part of a huge "For Next" loop that will incriment iFileIndex and rerun this script until all the files have been checked
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17000139
If CopyStatus = 1 Then
        m_fso.CopyFile NFile.Path, CFile.path, True
End If
0
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 500 total points
ID: 17000172

you better try this one, because when a file is not found, one of the objects is empty and the file isnt copied

If CopyStatus = 1 Then
        m_fso.CopyFile NFileList, CFileStr, True
End If
0
 
LVL 5

Author Comment

by:NAORC
ID: 17000181
You Guys are a lazy programmers dream...

Thanks y'all
0
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 17000202

and you are a lazy expert's dream:
not too difficult questions, and much points!




thanks for the points, and good luck with your app!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question