Solved

Urgent (but simple) FileSystemObject Question

Posted on 2006-06-28
5
162 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 142

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Put text in a picture ASP.NET C# 2 56
VB6 - Convert HH:MM into Decimal 8 54
Macro Excel - Multiple If conditions 2 71
Sub or Function is not defined 6 26
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

808 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