IFailAtLinux
June 9th, 2007, 05:10 PM
Hello,
I'm trying to make simple shell script to archive a lot of folders(and their contents) contained in one directory to different archives. It can be in .zip, .rar or .7z after archiving, but only those 3 are acceptable. I tried putting something together, but it never worked right. Well, I'm bad at describing things so I'll give an example of what I want to do. Let's say that after "ls" given directory I get:
Directory 1
Directory 2
...
Directory n-1
Directory n
Some(most) of the directories contain spaces, I don't know if that'll make things harder. In the efect of the script I want to get something like this:
Directory 1.zip //contains what "Directory 1" did contain
Directory 2.zip //contains what "Directory 2" did contain
...
Directory n-1.zip //contains what "Directory 3" did contain
Directory n.zip //contains what "Directory 4" did contain
Where extension can be .rar of .7z instrad of .zip. It would be nice if script would ask if it should delete original files if the archive is created successfully, but it's not necessary. I tried asking some people already, but no-one could do that. I would appreciate if someone could write something like that if it's not too much work, and if it is I would be content with some guidelines for how to write it. But still I'm better at learning from the source :)
I'm trying to make simple shell script to archive a lot of folders(and their contents) contained in one directory to different archives. It can be in .zip, .rar or .7z after archiving, but only those 3 are acceptable. I tried putting something together, but it never worked right. Well, I'm bad at describing things so I'll give an example of what I want to do. Let's say that after "ls" given directory I get:
Directory 1
Directory 2
...
Directory n-1
Directory n
Some(most) of the directories contain spaces, I don't know if that'll make things harder. In the efect of the script I want to get something like this:
Directory 1.zip //contains what "Directory 1" did contain
Directory 2.zip //contains what "Directory 2" did contain
...
Directory n-1.zip //contains what "Directory 3" did contain
Directory n.zip //contains what "Directory 4" did contain
Where extension can be .rar of .7z instrad of .zip. It would be nice if script would ask if it should delete original files if the archive is created successfully, but it's not necessary. I tried asking some people already, but no-one could do that. I would appreciate if someone could write something like that if it's not too much work, and if it is I would be content with some guidelines for how to write it. But still I'm better at learning from the source :)