Page 1 of 2

Saving a difference to a text file

Posted: Fri Mar 05, 2021 6:52 am
by ceo54
Hello,

I have a small project but I'm not geeky enough to accomplish this on my own hence I need a little help.

I want to compare all the files in the two directories and their respective sub-directories, make a .txt file of the difference of excess files, ignoring the timestamps, to be able to delete them in one go as a batch file.

Any help will be greatly appreciated.

Thanks.

Re: Saving a difference to a text file

Posted: Fri Mar 05, 2021 4:19 pm
by psguru
You should be able to achieve this by using command line with the /o option: https://www.prestosoft.com/ps.asp?page= ... ne_options

Re: Saving a difference to a text file

Posted: Fri Mar 05, 2021 11:15 pm
by ceo54
psguru wrote: Fri Mar 05, 2021 4:19 pm You should be able to achieve this by using command line with the /o option: https://www.prestosoft.com/ps.asp?page= ... ne_options
That seems straight forward. Thanks!

Another question, how do I make file list of two directories and their sub-directories to begin with ? Then comes the part where I would want to save the difference to a txt file.

Re: Saving a difference to a text file

Posted: Sat Mar 06, 2021 10:06 am
by psguru
You don't have to make a file list before comparing directories but if you want, you can use Windows command prompt and "dir" or "tree /a /f" command.

Re: Saving a difference to a text file

Posted: Sat Mar 13, 2021 2:09 pm
by ceo54
So far so good. I compared the files, created a text file with difference now I'm gonna have to figure out how to convert the paths for command prompt to understand and delete the files in one go.

Thank you for the help. Highly appreciated.

Re: Saving a difference to a text file

Posted: Tue Mar 16, 2021 10:44 am
by ceo54
Okay so I compared two files and made a difference file from Reports.

Now I have two issues:
1-The difference report added numerical lines in between the filelists (where did they come from ? the files I compared had no numerical values in them)

2. The difference file contains the difference for both the files whereas I just want the difference of one file, the one I choose.

Is there any way to over come these two issues ? First, I just want one file listed in the difference file per line below the folder path without any number lines in between. Second, I just want the difference of one file not both. Only the second file has the excess files but the difference file lists the folders from the first file too.

Thank you for the kind support, it's highly appreciated.

Re: Saving a difference to a text file

Posted: Tue Mar 16, 2021 10:55 am
by psguru
Could you attach screenshots with explanations?

Re: Saving a difference to a text file

Posted: Fri Mar 19, 2021 11:41 am
by ceo54
Hi again,

Here's an example of a difference file I created.

Code: Select all

1121c1115
< C:\temp\Mount\Users\Default\ (15)                                                                                                                             
---
> C:\temp\Mount\Users\Default\ (10)                                                                                                                             
1129,1133d1122
< ntuser.dat.LOG1                                                                                                                                               
< ntuser.dat.LOG2                                                                                                                                               
< NTUSER.DAT{fd2528e9-7130-11e4-80c1-a4badb27af85}.TM.blf                                                                                                       
< NTUSER.DAT{fd2528e9-7130-11e4-80c1-a4badb27af85}.TMContainer00000000000000000001.regtrans-ms                                                                  
< NTUSER.DAT{fd2528e9-7130-11e4-80c1-a4badb27af85}.TMContainer00000000000000000002.regtrans-ms                                                                  
3369c3358
< C:\temp\Mount\Windows\Inf\ (440)                                                                                                                              
---
> C:\temp\Mount\Windows\Inf\ (439)                                                                                                                              
3766d3754
< setupapi.offline.log                                                                                                               
As you can see, the folder "C:\temp\Mount\Users\Default\" is listed twice because it appears in both text files even though only one of the text files have excess lines (files) in the folder. What I want to do is when creating a difference file, I want to completely ignore what's in the first txt file I'm comparing. I just want the contents of the second file I compared listed in the difference file. Can this be accomplished ?

Second isse is, as you can see from the difference file I pasted, there are numerical figures at random lines starting with first line "1121c1115" They appear randomly throughout the difference file. I didn't have these in the files I compared. Hoow can I get rid of them ?

These are just the two things holding me back, apart from that absolutely great work. Very efficient software. And again your support is highly appreciated.

Re: Saving a difference to a text file

Posted: Fri Mar 19, 2021 9:03 pm
by psguru
As you can see, the folder "C:\temp\Mount\Users\Default\" is listed twice because it appears in both text files even though only one of the text files have excess lines (files) in the folder. What I want to do is when creating a difference file, I want to completely ignore what's in the first txt file I'm comparing. I just want the contents of the second file I compared listed in the difference file. Can this be accomplished ?
The problem is that your files contain numbers in parentheses, e.g. (15), and this makes your two lines in question different.
Second isse is, as you can see from the difference file I pasted, there are numerical figures at random lines starting with first line "1121c1115" They appear randomly throughout the difference file. I didn't have these in the files I compared. Hoow can I get rid of them ?
This lines are part of the normal diff output format (see, for example, http://kirste.userpage.fu-berlin.de/che ... iff_3.html) and cannot be removed.

I'm still not sure why you can't use directory comparison and instead chose to dump your directories to two text files and compare them.

Re: Saving a difference to a text file

Posted: Sat Mar 20, 2021 10:23 am
by ceo54
psguru wrote: Fri Mar 19, 2021 9:03 pmThe problem is that your files contain numbers in parentheses, e.g. (15), and this makes your two lines in question different.
Okay understood but what if I want to completely ignore the first file and only want the contents of the second file listed in the difference report ?
This lines are part of the normal diff output format (see, for example, http://kirste.userpage.fu-berlin.de/che ... iff_3.html) and cannot be removed.
That's too bad
I'm still not sure why you can't use directory comparison and instead chose to dump your directories to two text files and compare them
Please tell me how to do this. I have to find an easier and less tedious way to do it. I will be eternally grateful to you.

Thank you.

Re: Saving a difference to a text file

Posted: Sat Mar 20, 2021 10:29 am
by psguru
Please tell me how to do this. I have to find an easier and less tedious way to do it. I will be eternally grateful to you.
You can start by using the GUI to compare directories. Once you got the results you like, use the same command line you have but with directories instead of files.

Re: Saving a difference to a text file

Posted: Sat Mar 20, 2021 1:10 pm
by ceo54
Comparing directories is not possible for two reasons. First, two images can't be mounted at once. Second, the file list to be compared is part of the revision and comes from much older version.

Do I have any other choice ? I was thinking, being so advanced program Examdiff is, isn't there ignore options I could use to ignore the first file completely and then ignore the numerical lines and voila get the results I want ?

Re: Saving a difference to a text file

Posted: Sat Mar 20, 2021 8:15 pm
by psguru
I'm not sure what you mean by ignoring the first file completely. You can, however, ignore lines using regular expressions. See, for example, https://www.prestosoft.com/edp_tutorial_adv2.asp

Re: Saving a difference to a text file

Posted: Wed Mar 24, 2021 7:44 am
by ceo54
I mean ignoring whatever in the first file, to be listed in the difference file. For example the difference file I pasted has "C:\temp\Mount\Users\Default\" folder listed twice because it appears in both files I'm comparing. Now if the difference report ignore the first file, whatever maybe in there and only list the contents of the second file, I will not have the folders listed twice. What ignore syntax do I have to use for this ?

Second, is there any ignore syntax I could use to get rid if the random numerical lines too ? I understand you said I can't get rid of them but I want to know if there's any ignore syntax that allows me to ignore them too as my last resort ?

Re: Saving a difference to a text file

Posted: Wed Mar 24, 2021 8:09 am
by psguru
Start by ignoring numbers using the link I sent earlier. Maybe then the first issue will get resolved.