1. check the files with the same prefix 2. create a directory base on the prefix of the files3. move the files with the same prefix on that directory4. go to the created directory and extract the files.

You don't want to cd to the folder (from here on out I will call it a directory, since that's *nix talk) while in the loop, unless you cd back out before the next iteration. Since it seems this portion is just a sorting... I would say you don't need to cd to the directory at all, but you might want to add the directory to a list to cd into later. In fact, you could avoid the system doing the same things over and over by separating the task a little more... like:

The above gets all the prefixes at once, then goes down the list of those prefixes, adding their name to a file called "new_directory.lst" then making the folder and moving all files with that prefix to that new directory. The list was only made if you needed to go back later and go into each of those folders to do something else (like extract further). You would just have to iterate through the list, cd'ing to the directory, and executing a rar for each file in the directory.

You could also just do the further extraction while in the loop, you just have to make sure of your path while you work... like:

Who is online

Users browsing this forum: No registered users and 1 guest

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