Search This Blog

Thursday, October 5, 2017

Mind-Blowing

I created a MS-DOS batch file that creates a .zip file of each folder in a directory structure. It is the most awesome & coolest code I've ever assembled. I don't really consider myself a programmer or a coder - I'm a code assembler. I get an idea for what I want to do and use Google.com because I do not have the training / education to write original code. I rely on the work done by others to read sites like the following to create what I want:
That's why I embrace the day on which I can tell my son what I want to do and to hear him explain back to me how to do it. After I had what I wanted to do figured out, I sent him the following instructions. I will see him on Saturday, when we go to the UNI football game in Cedar Falls, but it will be unlikely that I have a lot of time to sit and help him set this up on his laptop / external hard drive.

  1. Download http://www.7-zip.org/
  2. Install 7-zip – you can install it on your external hard drive, if you want (that’s what I did).
  3. On your laptop, right-click on the Desktop and from the menu that pops up, select New > Text Document.
  4. After Notepad opens, paste the following text in the Notepad window:
    for /d %%X in (*) do "b:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\" -mx=5 –tzip
    • You will need to replace the path in quotes with the path to where you installed. If you install to your external hard drive and it’s your “E” drive, you would have this text:
      • for /d %%X in (*) do "e:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\" -mx=5 –tzip
    • Save the file as zipall.bat.
  5. On the Desktop, select the file, right-click, and select Copy.
  6. Find a folder that has many sub-folders in it. I used my b:\music_shell folder which has 38 folders.
  7. Double-click the zipall.bat.
    • A DOS window will open that it looks like this:
    • Ignore the warning: WARNING: The system cannot find the file specified. ûtzip
  8. As it processes, you will start to see a .zip file for each folder:
  9. It will run for a long time. You will not want to be making changes to the files in the folder you are running this in because then you won’t really have a good backup of it.

And here's the funny thing - following the above steps does not create a backup - it creates .zip files and a 'snapshot' but those .zip files need to be moved to a different external hard drive or to the Cloud or someplace else in order to have an authentic backup.

Now that the DOS batch file is complete, I see this in my b:\music_shell folder:


I am also using a DOS batch file for my RoboHelp projects.

No comments: