# need some pointers on which tools to use for a script i need



## wonslung (Jul 30, 2009)

i need to write a script that will do the following:
check each subdirectory of a particular path for rar files then unrar them to another location, and keep track of which ones it's already hit...doesn't absolutely have to keep track perse, i'm thinking i can output the text to a file in the directory of the rar file and if the script SEES this file, it will know not to unrar these files.

I'm VERY new to shell scripting...i've writen 3 successful...very simple scripts....eventually i want to be able to write a script that will use cksfv to see if the files are complete, then make a torrent with them...but these things are kind of similar though i think the second one will be harder....i'm not asking anyone to write it for me, i just want to know which tools i should look at,. and which man pages i need to read.

Thanks, i'm kind of stuck


----------



## SirDice (Jul 30, 2009)

You can use find(1) to find the rar files. Find can also -exec things but you might just want to read the list of files and process them. Once your script is done you could do a touch(1) to create a marker file. Find is also able to find files that are -newer then the marker file (So it'll find all the rars created since you last ran your script).

If you want to unpack in a different directory something like *cd /dest/dir && unrar x "$file" && cd -* will work. *cd -* will change directory to the previous cwd (before the last cd command).


----------



## wonslung (Jul 30, 2009)

SirDice said:
			
		

> You can use find(1) to find the rar files.



you know, i don't know why i didn't think of that...i use cpio all the time to copy recursively with timestamp/permissions/soft/hardlinks..

thanks SirDice


----------

