Solved

Urgent (but simple) FileSystemObject Question

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now