• Welcome to Jose's Read Only Forum 2023.
 

Fixer Program For True Image File Restore Problem

Started by Donald Darden, November 11, 2007, 02:22:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Donald Darden

Several version of Acronis' True Image offer you a file and folder restore option instead of requiring you to restore a whole disk or partition(s).  And the program asks you what it should do if the file already exists.  The choices are to overwrite existing files, to overwrite older files, and to not replace those files.

The problem is, this is a narrow range of options.  Think about it for a minute.  You are having trouble because you have a growing number of FOUND.xxx folders with bits of files and directories in them, and you also have new stuff on your PC that are not contained in the archive.  Your best choice seems to overwrite older files, and in that way get back the missing files but not replace any that might have been modified since the archive.

So True Image does it's thing, which takes perhaps two or three times longer than just restoring an image.  Understandable, since with individual folder and file restores take longer since any old files have to be removed, and each one added has to update the drive table and directory structue - work that can be skipped when the whole drive is being restored in one step.

Then you look at your machine, and there is a huge number of files that have been added that are named the same as existing files, but with a ~ symbol and eight randomly generated letter & digit characters attached.  For instance, if you had a link file named PowerBasic.lnk it might now have a twin named PowerBasic.~HF8I42JQ in the same directory.  It is totally surpurflous, so you delete it,  But this problem exists everywhere where you attempted to perform a partial restore based on just bringing back specific folders and files.  In my case, I ended up with 11,090 unnecessary added files from attempting this.

I performed a search on my PC using this mask to locate all such files:  *???.*~????????.  This eliminated a number of possible false matches, but I still found 11,090 added files that were taking up a lot of added disk space.  And Windows totally choked when I tried to get rid of files by clicking on them in the search list and selecting delete.  It got worse when I tried to use the left shift key to select groups of files and delete them at once.

So I decided to write a little program to scan my hard drive for all such named files and get rid of them automatically.  It is a small program, but proved to be very effective.  The only downside is that the dd string gets very long, so Windows twice had to stop and extend the size of the swap file to accomodate the accumulated unprocessed directory tree.  It is possible to avoid this by constructing an array to hold the name of a directory tree, and replacing the full named path with an index reference into that array, and reconstruct the entire path on the fly, but I will let others tinker with that idea.   
#COMPILE EXE
#DIM ALL
#DEBUG ERROR ON
#REGISTER NONE
GLOBAL a, b, AS LONG
GLOBAL aa, bb, cc, dd, eei AS STRING
FUNCTION PBMAIN () AS LONG
  dd="c:"+$NUL+"d:"+$NUL     'name all the drives to be processed here
  ee="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  COLOR 15,1
  CLS
  DO WHILE dd>""
    aa=PARSE$(dd,$NUL,1)
    dd=MID$(dd,LEN(aa)+2)
    ERRCLEAR
    IF RIGHT$(aa,1)<>"\" THEN aa=aa+"\"
    bb=DIR$(aa+"*.*",23)
    DO WHILE bb>""
      OPEN aa+bb FOR INPUT AS #1
      a=ERRCLEAR
      CLOSE 1
      SELECT CASE a
      CASE 0
        a=INSTR(bb,".")
        IF a THEN
          a=INSTR(a+1,bb,"~")
          IF a THEN
            cc=MID$(bb,a+1)
            IF LEN(cc)=8 AND REMOVE$(cc,ANY ee)="" THEN
              ?aa+bb
              a=GETATTR(aa+bb)
              IF (a AND 7)=1 THEN SETATTR aa+bb, (a AND 254)
              KILL aa+bb
              ERRCLEAR
            END IF
          END IF
        END IF
      CASE 70
        dd=dd+aa+bb+$NUL
      CASE ELSE
        COLOR 14
        ? bb,a
        COLOR 15
        'waitkey$
      END SELECT
      bb=DIR$
    LOOP
  LOOP
END FUNCTION