Category Archives: Windows Administration

Make windows files/folders permissions right

There are times on windows when you migrate your files to a new system and you will face the corrupted permission-sets on your files or folders. These 4 cmd commands will help you gain your control over your files again 🙂

<Drive>:
CD \
TAKEOWN /F * /A /R 1 > NUL
ICACLS * /reset /T /Q

Just remember to create a batch file containing those lines above. 🙂

RAR CLI to split files

The popular winRAR has a CLI that comes really handy specifically when you need a superior compression while developing application. The good news is you can fire a process to run the RAR.EXE; but the downside is there’s no obvious help for the CLI except the minimally provided help on the command prompt.

The following command should be a rather complete help for some frequently-used features of RAR.EXE:

rar a -r -v100m -m5 -hpPassword D:TempRARTeststest1.rar "iPhone 2012-10-18*.*"

Description:

a		Means "add to archive".<br />
r		Means do the "addition" recursively for sub-folders.<br />
-v100m		Means the archive should be splitted into 100m sub-archives.
		m: 1024 bytes MEGA = 1024*1024 bytes
		M: 1000 bytes MEGA = 1000*1000 bytes
		There are also k and K suffixes for KILO<br />
-m5		Tells the RAR.EXE to use its maximum compression.
		the number after "-m" can be an integer in the range of [0,5]
		0: No compression = store
		3: Normal compression
		5: Maximum compression
-hpPassword	Uses the phrase "Password" to encrypt the archive's contentand also
		encrypts the archive's headers containing the names of files/folders in the archive.
		if "-p" is used instead of "-hp", the contents will be encrypted only.
		NOTE: -p leaves the filenames to be openly seen...

D:TempRARTeststest1.rar
is the path to target archive to be created and

“iPhone 2012-10-18*.*”
is the source file(s)/folder(s) path to be compressed into the archive.
Note that if  RAR.EXE will include the folder structure of your source files/folders into the archive. In our example, the archive will contain a folder called “iPhone 2012-10-18” and its files and sub-folders. The source name is quoted because it contains spaces.