Home » Developing U++ » UppHub » Console Directory Compare
Console Directory Compare [message #23759] |
Thu, 19 November 2009 21:04 |
Reini
Messages: 28 Registered: April 2009 Location: Berlin
|
Promising Member |
|
|
Hello U++ Fans,
For my daily job I wrote a small Directory Compare tool for the command line. At first it sounds stupid since there are several tools already available. But this one does the compare by filename and filesize. It uses Vectormap for saving filenames and filesizes and has one recursive function for that.
In the source there is also one function for searching recursively directories which I tried first but was useless in this case.
Anyway possibly Mirek can add it to the Core lib ?
Have fun with the code and use it as you which for batch files or for small and quick Dir Compares. For ideas of improvement or suggestions please contact me.
Important ! This one does no content compare of files since CompDir of the U++ Examples does this already. This way it is fast and useful enough for quick checks.
bool GetFoldersRecursive(String startDir, String& resultPath)
{
FindFile scanFolders;
//If no Folders were found exit immediately
if( !scanFolders.Search(AppendFileName(startDir, "*.*")) )
return false;
//Check for Folders and add them to the given Stringbuffer with Foldername
while(scanFolders)
{
//If Folder was found store it and start recursively again to scan in this Folder
if ( scanFolders.IsFolder() )
{
String nextDir = AppendFileName( startDir, scanFolders.GetName() );
resultPath = resultPath + nextDir + ";";
GetFoldersRecursive( nextDir, resultPath );
Cout() << nextDir << "\n";
}
scanFolders.Next();
}
return true;
}
Greets from Berlin
|
|
|
Goto Forum:
Current Time: Wed Apr 30 05:04:29 CEST 2025
Total time taken to generate the page: 0.04205 seconds
|