What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » What would be the best way to doing this (mass .zip'ing + DIFFERENT password + log)

What would be the best way to doing this (mass .zip'ing + DIFFERENT password + log)
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: What would be the best way to doing this (mass .zip'ing + DIFFERENT password + lo
A batch file should indeed be perfect for this one-time job....

This will do the trick:
code:
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

REM Change following line to proper WinRar path and command line tool (don't forget the quotes)
SET RAREXE="C:\Program Files\WinRAR\RAR.EXE"

DEL PASSWORDS.TXT
FOR /D %%M IN ("*.*") DO (
  SET PWD=0000!RANDOM!
  SET PWD=!PWD:~-5!
  CALL %RAREXE% a -m5 -p!PWD! -r -ep1 "%%M.RAR" "%%M\"
  ECHO %%M.RAR ^| !PWD! >> PASSWORDS.TXT
)

Save it as a batch file and put it in the directory which contains all the directories you want to archive.
Then run it from the command line.
It will create a RAR for each subdirectory with a random password.
The password will always be 5 digits long.

There is no error checking, so make sure you have enough free space for the archives.
The archived directories will NOT be deleted afterwards.


EDIT-PS: If you want the password to be longer you could replace those two SET-lines with something like:
code:
  SET PWD=00000000!RANDOM!!RANDOM!
  SET PWD=!PWD:~-10!

which will produce a password with 10 digits.
Change the 10 into something lower to produce a password of X digits.

%RANDOM% (and with delayed expansion enable: !RANDOM!) will produce a random number between 0 and 32767. See the help for the command SET (SET /?).

This post was edited on 03-31-2009 at 06:36 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-31-2009 06:29 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
What would be the best way to doing this (mass .zip'ing + DIFFERENT password + log) - by prashker on 03-31-2009 at 03:53 AM
RE: What would be the best way to doing this (mass .zip'ing + DIFFERENT password + lo - by CookieRevised on 03-31-2009 at 06:29 PM
RE: What would be the best way to doing this (mass .zip'ing + DIFFERENT password + log) - by prashker on 03-31-2009 at 09:01 PM
RE: What would be the best way to doing this (mass .zip'ing + DIFFERENT password + log) - by noir on 04-01-2009 at 07:23 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On