This page is part of © FOTW Flags Of The World website

Removing obsolete files under Windows

Last modified: 2012-04-07 by peter hans van den muijzenberg
Keywords: fotw | mirror |
Links: FOTW homepage | search | disclaimer and copyright | write us | mirrors



See also:


Introduction

Instructions as sent to the FOTW mailing list by António Martins. If they don't work - contact him, not me! It is simple, but will work on Windows PCs only. There's a separate page with instructions for Unix and, with some adjustments, the same methods may be applied for any other environment supporting command line style batch operations. (I guess that it may be possible to pull this kind of stunt on a Mac.)

Instructions for immediate deletion

  1. Read this all until the end first, make sure you understand what you'll be doing.
  2. Open the obsolete files list in a text editor; keep a backup of the obsolete files list and/or mind not to save it again, with changes, with the same filename!
  3. Remove all lines except those actually including the obsolete files, including the titles ("MISC", etc.).
  4. Replace every "> 1", "> 2" and "> 3" with nothing -- these will disappear (see below what are they for).
  5. Replace "1 <" with "delete flags\", "2 <" with "delete images\" and "3 <" with "delete misc\".
  6. Save the list as plain text, and rename it to <somethng.bat> -- this will be a DOS batch file. You may use a name other than "somethng", but the extension "bat" is mandatory. (But see note b!)
  7. Move or copy this file to the root directory of your home copy of FOTW-ws (i.e., the place where you have the folders /flags/, /images/ and /misc/), and execute it (click it, or type enter having the focus on the BAT file icon).

And that's it.

Instructions for keeping deleted files

You might however want to keep the deleted obsolete files (especially because, at least in some versions of Windows, the files deleted in a DOS session are really deleted, not just moved to the recycle bin). In this case you'll have to add and/or replace from the steps above the following:

  1. Replace "> 1" with " obsolete\flags", "> 2" with " obsolete\images" and "> 3" with " obsolete\misc". (Mind the space before "obsolete"!)
  2. Replace "1 <" with "move flags\", "2 <" with "move images\" and "3 <" with "move misc\".

    1. IF THIS IS THE FIRST TIME YOU'RE MOVING OBSOLETE FILES, write the following at the top of the list:
      
              md obsolete
              md obsolete\flags
              md obsolete\images
              md obsolete\misc
            
    You may copy and paste from here.

After doing this, you'll have a folder called /obsolete/ at the same level as /flags/, /images/ and /misc/, itself subdivided in /flags/, /images/ and /misc/, there containing the deleted files from each folder.

Important notes

a
The backup of obsolete files will keep all deleted files (until you delete them yourself) except for those with the same filename at the same location, something that might occur from one month to another (not so frequent, but even so).
b
(about step 8) If you have Windows 95 or higher and you have selected the option "Hide MS-DOS file extensions for file types that are registered", all this will probably not work. To disable this option, go to the Windows Explorer and select "Options" from the menu "View" and turn off the check box referred above. Now Windows will show the dot-and-three-letter filename extension for each file. If you don't want to see this (beats me why you wouldn't, but...), go to the same option and check it on again after the deleting/moving of obsolete files is finished.
c
Be very careful when dealing with deletion lists from earlier months. It is very possible that the file, say, <su-geab2.gif> was listed as obsolete in, say, march, and the added again (or better, a new file with the same name) in, say, August. It would be very difficult to keep track of this, so, if you really want a "clean" off line copy of FOTW-ws, better get those "all" zips anew and consider only the deletion of obsolete files next time you make a monthly update.

DISCLAIMER AND TERM OF RESPONSIBILITY

ALL OF THE ABOVE WAS PUT AS SIMPLY AS I COULD, AND THE PROCESS ITSELF IS PRETTY STRAIGHTFORWARD FROM A COMMAND LINE PROGRAMMING POINT OF VIEW. HOWEVER, IT MAY HAPPEN THAT, WHILE PERFORMING SOME OF THE STEPS ABOVE, YOU DO SOMETHING WRONG AND YOUR OFF LINE COPY OF FOTW-WS GETS DAMAGED -- OR EVEN OTHER AREAS OR YOUR DISK! I HEREBY DECLINE ALL RESPONSIBILITY FOR THE ABOVE; PLEASE USE IT AT YOUR OWN RISK ONLY. (Sorry for shouting -- but it is impressive, isn't it?
;-)