I don't use WinRar so the command line may have to be fixed. I just gleaned it from eleman's post.
Script should be self-explanatory. You should enter the path as well as filename or the script will start searching in the working directory. For example, to search all folders on C: for readme.txt use C:\readme.txt as the command line arg.
edit: if no file specified on command line, Input Box asks for the file name. As noted above, the path in the file name with be the start of the folder search. Otherwise it will start in the folder where the script is.
Not tested as I don't have rar.exe installed
; run with filename on command line
; whatever the starting directory of the filename, it will recursively dig into all folders beneath
;
if 0 < 1
{
InputBox,FilePat,,Enter File Name (e.g. C:\readme.txt)
if (ErrorLevel)
ExitApp
}
else
FilePat = %1%
Loop, %FilePat%,,1
{
tmp := _FilePathNoExt(A_LoopFileLongPath) . ".rar"
RunWait,rar m -x*.rar -m5 %tmp% %A_LoopFileLongPath%
}
; --------- path manipulation functions - file doos not need to exist, but passing path="" tends to mess them up ----
_FilePathNoExt(path)
{
return _FileDirWithSlash(path) . _FileBaseName(path)
}
_FileExt(path)
{
SplitPath,path,,,ext
return ext
}
_FileBaseName(path)
{
SplitPath,path,,,,basename
return basename
}
_FileName(path)
{
SplitPath,path,filename
return filename
}
_FileDir(path)
{
SplitPath,path,,fdir
return fdir
}
_FileDirWithSlash(path)
{
return _FileDir(path) . "\"
}