Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to create a folder in a RAR file and then add a file inside that folder. What commands should be issued to create a structure as follows?

File.exe(SFX Archive) > Folder > File.txt

I am trying to use this command:

rar a -ep1 -sfx rar.exe/folder file.txt

However it does not work and says that rar.exe/folder not found. The help file does not show a way to add a folder or directory inside an archive.

share|improve this question

migrated from stackoverflow.com Aug 20 '11 at 23:15

This question came from our site for professional and enthusiast programmers.

    
Which RAR utility do you currently use on your system? Or do you currently have one? –  Mark Schadler Jul 14 '11 at 15:09
    
WinRAR and am using Windows XP. –  Apoorv Jul 14 '11 at 15:11

2 Answers 2

up vote 1 down vote accepted

You don't want the sfx switch, because you are adding to an existing SFX archive. Thus your command should be along the lines of:

rar a -ep1 file.exe file_or_folder_to_add

Where file.exe is your existing SFX archive and the last parameter is the path to the file or directory you wish to add.

share|improve this answer
    
I want to add the file present in my current folder but I want to put that file in Cody Folder inside the RAR Archive. Using the above mentioned command I'll be able to make the directory structure which will be the same as the place from where I copy and not a new folder structure inside the Archive File. –  Apoorv Jul 14 '11 at 19:13
    
Suppose I want to create the directory structure as: File.exe > Folder > Folder 1 > File.txt and I want to push the file located in my current folder so according to your method it won't create any folder inside the archive file. –  Apoorv Jul 14 '11 at 19:23
1  
You then must up the -ap switch. Thus the way to do what you want would be rar a -ep1 -ap"Folder\Folder 1\" File.exe File.txt. Note there is no space after the -ap option. –  Mark Schadler Jul 14 '11 at 20:12
    
Thanks it worked, didn't get any example earlier to understand its usage. –  Apoorv Jul 15 '11 at 5:37

I think I found the solution: you should use the -ep1 -ap\FolderYouWant parameter. This creates a folder called FolderYouWant inside the rar archive and put the files you determined in it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.