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:
prashker
Veteran Member
*****


Posts: 5109
Reputation: 104
– / Male / –
Joined: Mar 2005
Status: Away
O.P. What would be the best way to doing this (mass .zip'ing + DIFFERENT password + log)
So I have 1171 folders all inside a main folder (S:\Folders\)

For each folder I want it to be
-Zipped
-Passworded

But I want the passwords to be random.

For each zip file I want the name + password added into a file

Passwords.txt

<Name> | Password
<Name> | Password
<Name> | Password
<Name> | Password
<Name> | Password
<Name> | Password
<Name> | Password
<Name> | Password
<Name> | Password

Basically a quick way of referring to the zipped file and finding out it's password.

Something along those lines and something that would be automatic.

What would be the best approach, is there a program that can do this, maybe a batch file using rar.exe?

Thanks,
-Sam ;>
03-31-2009 03:53 AM
Profile PM Find Quote Report
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
prashker
Veteran Member
*****


Posts: 5109
Reputation: 104
– / Male / –
Joined: Mar 2005
Status: Away
O.P. RE: What would be the best way to doing this (mass .zip'ing + DIFFERENT password + log)
I love you....(l)

Thanks :D, I'll be using this in a few days and this will cut the time needed to do it SIGNIFICANTLY :D!

This post was edited on 03-31-2009 at 09:02 PM by prashker.
03-31-2009 09:01 PM
Profile PM Find Quote Report
noir
New Member
*

Hating White Backgrounds since 1994-

Posts: 6
44 / Female / –
Joined: Apr 2009
RE: What would be the best way to doing this (mass .zip'ing + DIFFERENT password + log)
small tip on adding just a single pw to a single zipped rar file?
04-01-2009 07:23 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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