AutoHotkey Community

It is currently May 27th, 2012, 2:55 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Questions about Winrar
PostPosted: November 27th, 2009, 3:40 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
Hi ahk masters.

I have a little AHK project in mind and part of it includes the compressing (rar.exe) function of WINRAR. Since this is not mainly about ahk I decided to post it here.

About the rar command there is one inconvenience: When I use this command-line entry...

Code:
D:\Testes\torar>rar a D:\Testes\torar\rarei.rar D:\Testes\torar\*.txt


...to put all the .txt files in the directory "torar" in a .rar archive, the resulting .rar pack will have, inside, exactly the same full directory tree from where the file was created. For example: if my .txt files are in the following folder,

Code:
C:\documents\level 1\level 2\level 3


...the rar will create all this folders, in that same hierarchy (documents - level 1 - level 2 - level 3) and only then the .txt files.

Question for now: what is the parameter or any other solution to have rar.exe create the rar in the current direcory level, without creating the full matching tree? Thanks in advance.

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 2:52 pm 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
Code:
RAR.exe a -ep1 test torar\*


Have a look at the helpfile under command line syntax -> switches


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2009, 9:17 pm 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
There is no helpfile! :(
I searched around the web and found very little documentation about the command line functions. My main help is the command list that shows up when I simple type "rar" at the command prompt.

Thanks! This removed the full tree above the files.

What is the switch/parameter I use to include all subfolders, with no exception or depth limit, in the archive?

Thanks in advance haichen.

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2009, 10:52 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
Here http://www.scribd.com/doc/15681481/Rar I found a full documentation. It can be downloaded in plain text and in pdf formats, BUT only after registration. :roll: :evil: for reading it online, no registration is needed.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2009, 2:46 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
Thanks! I am already registered, so I got the pdf. Nice.

There I could see the list of switches, and the closest to what I want is the -r. So the command got like:

Code:
rar a -ep -r letras @lista.lst


But, although it includes files in subdirectories, the directory hierarchy is not mantained, and the resulting archive will have all files in the same level. for example: I have a folder called "lyrics", in which I keep some txt files, such as: song1.txt and song2.txt. Inside, I have a subfolder called "rock", where I keep the files rocksong1.txt and rocksong2.txt.

After performing the above command, the resulting archive will have the following list
song1.txt
song2.txt
rocksong1.txt
rocksong2.txt

instead of...

song1.txt
song2.txt
rock\rocksong1.txt
rock\rocksong2.txt

Got it?

How to fix that?

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 12:26 am 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
If you install winrar there is a helpfile winrar.chm in the program dir.
You can also get access to it in winrar->Help->help topics

And if you want to maintain directories there are two ways:
Code:
RAR.exe a -r -ep1 test torar\*

or
you make a bat like this
Code:
cd torar
rem go into the dir
RAR.exe a -r  ..\test
rem add rekursiv (-r) files and dirs to a test.rar  and save it one directory above (..\)

I tested this and both variants are working

You can add C:\Program Files\WinRAR to your PATH so you don't have to copy rar.exe


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2009, 10:19 pm 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
Thanks a lot man!
And I'm sorry for late feedback.

I was successful at RAR'ing the current directory with all subdirs included with the following command:

Code:
RAR a -r -ep1 torarando.rar


But since I'm too noob for CMD and DOS, I don't know what "add to the path" is. I'm sorry, what is it? Does it have anything to do with the "working dir"? Only so I will be able to understand this bat:

Code:
cd torar
rem go into the dir
RAR.exe a -r  ..\test
rem add rekursiv (-r) files and dirs to a test.rar  and save it one directory above (..\)


Thanks!

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2009, 2:32 am 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
Open a DOS-box and type set. You get all environmentvariables. One of them is path.
Path is used to specify the location where MS-DOS looks when using a command. So you don't have to use the full adress in a DOS-script, like c:\windows\notepad.exe. You can start the program with it's name.
Type notepad in the dos box and you see what i mean.
Open Control Panel-Performance and Maintenance-System (or right-click on My Computer and choose "Properties"). In the box that opens, click the "Advanced" tab to obtain the dialog box shown below.
Next, click the button "Environment Variables". Here you can change the path variable.
For Winrar you add ;c:\program files\winrar (or whereever you installed it) to the end.
From now you can use the command rar.exe from every directory without preceding c:\program files\winrar\

Another Way to change the path var can be done in the bat file.
Write path = %PATH%;c:\program files\winrar in your .bat file. This changes the Path only for this script.

Nice link: http://www.computerhope.com/msdos.htm


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2010, 4:30 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
Thanks a lot bro!
And sorry for the long waiting.
Now I understand why some programs can be called directly while others need absolute path.

Just one question: what if I add hundreds of programs to the path, will I experience a performance loss?

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2010, 11:22 am 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
I don't think there is the needing to set a pathvar for hundreds of files.
You only need to set a path for programs you want to start from DOS-boxes,
and only when you want to start this program from a Dir that is not the programs Dir.
And some Systemdirectories are already in the PATH.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2010, 7:38 pm 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
Thanks a lot. :)

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: codybear and 6 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group