Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default compare contents of two folders

Morning folks.
I'm looking to compare the contents of two directories, and then output the
results to either a text file, or an excel file.
We'd tried using a batch command set that we'd found online, but it did not
provide the output we'd desired.
Most of what I'm finding out there are code comparison programs, and vba
code to check the contents of files, as well as subdirectory comparitors.

My goal is to simply check to see if the work done so far is being
duplicated or not; thus I want to compare the contents of two folders.
Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default compare contents of two folders

How about sub-folders?
Should their contents be compared or not?
--
Gary''s Student - gsnu200850


"Steve" wrote:

Morning folks.
I'm looking to compare the contents of two directories, and then output the
results to either a text file, or an excel file.
We'd tried using a batch command set that we'd found online, but it did not
provide the output we'd desired.
Most of what I'm finding out there are code comparison programs, and vba
code to check the contents of files, as well as subdirectory comparitors.

My goal is to simply check to see if the work done so far is being
duplicated or not; thus I want to compare the contents of two folders.
Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default compare contents of two folders

No.
In this case, we'll only be comparing top level directory's contents.


"Gary''s Student" wrote:

How about sub-folders?
Should their contents be compared or not?
--
Gary''s Student - gsnu200850


"Steve" wrote:

Morning folks.
I'm looking to compare the contents of two directories, and then output the
results to either a text file, or an excel file.
We'd tried using a batch command set that we'd found online, but it did not
provide the output we'd desired.
Most of what I'm finding out there are code comparison programs, and vba
code to check the contents of files, as well as subdirectory comparitors.

My goal is to simply check to see if the work done so far is being
duplicated or not; thus I want to compare the contents of two folders.
Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default compare contents of two folders

Do you only need to know if the same files are in both folders or do the
versions (timedate stamps) of the files need to be the same?
--
Gary''s Student - gsnu200850


"Steve" wrote:

No.
In this case, we'll only be comparing top level directory's contents.


"Gary''s Student" wrote:

How about sub-folders?
Should their contents be compared or not?
--
Gary''s Student - gsnu200850


"Steve" wrote:

Morning folks.
I'm looking to compare the contents of two directories, and then output the
results to either a text file, or an excel file.
We'd tried using a batch command set that we'd found online, but it did not
provide the output we'd desired.
Most of what I'm finding out there are code comparison programs, and vba
code to check the contents of files, as well as subdirectory comparitors.

My goal is to simply check to see if the work done so far is being
duplicated or not; thus I want to compare the contents of two folders.
Thank you.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default compare contents of two folders

Mainly if the same files exist.
Although, now that you mention it, knowing the other info would indeed be
helpful.


"Gary''s Student" wrote:

Do you only need to know if the same files are in both folders or do the
versions (timedate stamps) of the files need to be the same?
--
Gary''s Student - gsnu200850


"Steve" wrote:

No.
In this case, we'll only be comparing top level directory's contents.


"Gary''s Student" wrote:

How about sub-folders?
Should their contents be compared or not?
--
Gary''s Student - gsnu200850


"Steve" wrote:

Morning folks.
I'm looking to compare the contents of two directories, and then output the
results to either a text file, or an excel file.
We'd tried using a batch command set that we'd found online, but it did not
provide the output we'd desired.
Most of what I'm finding out there are code comparison programs, and vba
code to check the contents of files, as well as subdirectory comparitors.

My goal is to simply check to see if the work done so far is being
duplicated or not; thus I want to compare the contents of two folders.
Thank you.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default compare contents of two folders

Put the first folder path in A1 and the second folder path in B1 and run
TestListFilesInFolder:

Sub TestListFilesInFolder()
Application.ScreenUpdating = False
ListFilesInFolder Range("A1").Value, False, 1
ListFilesInFolder Range("B1").Value, False, 2
Application.ScreenUpdating = True
End Sub

Sub ListFilesInFolder(SourceFolderName As String, IncludeSubfolders As
Boolean, kolumn As Integer)
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder
Dim FileItem As Scripting.File
Dim r As Long, k As Integer
MsgBox (SourceFolderName & kolumn)
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(SourceFolderName)
r = Cells(Rows.Count, kolumn).End(xlUp).Row + 1
k = kolumn
For Each FileItem In SourceFolder.Files
Cells(r, k).Value = FileItem.Path
r = r + 1
Next FileItem

If IncludeSubfolders Then
For Each SubFolder In SourceFolder.SubFolders
ListFilesInFolder SubFolder.Path, True, kolumn
Next SubFolder
End If
Set FileItem = Nothing
Set SourceFolder = Nothing
Set FSO = Nothing
End Sub

The files will be listed below the folder paths.

Adapted from Joel Rubin's Site:

http://www.exceltip.com/st/List_file...Excel/446.html
--
Gary''s Student - gsnu200850


"Steve" wrote:

Mainly if the same files exist.
Although, now that you mention it, knowing the other info would indeed be
helpful.


"Gary''s Student" wrote:

Do you only need to know if the same files are in both folders or do the
versions (timedate stamps) of the files need to be the same?
--
Gary''s Student - gsnu200850


"Steve" wrote:

No.
In this case, we'll only be comparing top level directory's contents.


"Gary''s Student" wrote:

How about sub-folders?
Should their contents be compared or not?
--
Gary''s Student - gsnu200850


"Steve" wrote:

Morning folks.
I'm looking to compare the contents of two directories, and then output the
results to either a text file, or an excel file.
We'd tried using a batch command set that we'd found online, but it did not
provide the output we'd desired.
Most of what I'm finding out there are code comparison programs, and vba
code to check the contents of files, as well as subdirectory comparitors.

My goal is to simply check to see if the work done so far is being
duplicated or not; thus I want to compare the contents of two folders.
Thank you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare row contents Dylan Excel Programming 7 July 14th 08 09:05 PM
compare the contents of one range of cells with the contents of a. Dozy123 Excel Discussion (Misc queries) 1 January 24th 07 10:14 AM
Read- only Protect Folders and contents in WIN2K Server Tommydraw123 Excel Discussion (Misc queries) 3 October 31st 06 07:31 PM
Delete an entire folders contents (or just Excel files) DejaVu[_67_] Excel Programming 3 April 7th 06 09:29 PM
delete all the contents (sub folders and files) in the temp folder Joseph Excel Discussion (Misc queries) 0 June 6th 05 08:01 AM


All times are GMT +1. The time now is 12:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"