Erasing duplicate files of my share?

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

ODonell
Posts: 1
Joined: 2004-05-19 13:04

Erasing duplicate files of my share?

Post by ODonell » 2004-05-19 13:19

Hello, i would like delete the duplicates files from my HDDs.

I´m editing ShareManager.cpp and i try to insert a this command:

Code: Select all

if(dupe) {
   size-=f->getSize();
   if(!(BOOLSETTING(LIST_DUPES))) {
      LogManager::getInstance()->message(STRING(DUPLICATE_FILE_NOT_SHARED) + f->getName() + " " + "(" + STRING(SIZE) + ": " + Util::toString(f->getSize()) + " " + STRING(B) + ") (" + STRING(DIRECTORY) + ": \"" + f->getParent()->getName() + "\")", true);      
   }
   if (askedDelete==false){
      if (::MessageBox(NULL, "There are duplicate files.\n\nWould you like erased it´s?", APPNAME " " VERSIONSTRING "[" CZDCVERSIONSTRING "]", MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES) {
         deleteDupes = true;
         askedDelete = true;
      }else {
         askedDelete = true;
      }
   }
   if (deleteDupes==true){
      ::File::deleteFile(".\\" + f->getParent()->getName() + "\\" + f->getName());
      LogManager::getInstance()->message("Erasing duplicate file   .\\" + f->getParent()->getName() + "\\" + f->getName(), true);
   }
}


in the next code

Code: Select all

if(dupe) {
   size-=f->getSize();
   if(!(BOOLSETTING(LIST_DUPES))) {
      LogManager::getInstance()->message(STRING(DUPLICATE_FILE_NOT_SHARED) + f->getName() + " " + "(" + STRING(SIZE) + ": " + Util::toString(f->getSize()) + " " + STRING(B) + ") (" + STRING(DIRECTORY) + ": \"" + f->getParent()->getName() + "\")", true);
      }
   }

but i don´t know, how can a get the full path of the files that are duplicates?
May you help my


In the System Log file we see

2004-05-19 14:43:12: Erasing duplicate file .\compartido\Copia de Client.cpp
2004-05-19 14:43:12: Duplicate file will not be shared: Copia (4) de Client.cpp (Size: 21125 B) (Directory: "compartido")

psf8500
Posts: 23
Joined: 2003-03-04 23:51

Post by psf8500 » 2004-05-19 18:57

Code: Select all

ShareManager::getInstance()->translateFileName(f->getParent()->getFullName() + f->getName())


That should do it. btw shouldn't this be in programmers help?

Who is online

Users browsing this forum: Google [Bot] and 0 guests