ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

A software for compress file and able to find them first

<< < (4/4)

MilesAhead:
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) . "\"
}

Contro:
 :-[

I'll try. It seems very similar to the other one give me the error windows.

Going to study

 :P

MilesAhead:
:-[

I'll try. It seems very similar to the other one give me the error windows.

Going to study

 :P
-Contro (August 01, 2012, 07:59 PM)
--- End quote ---

I know the recursion works properly since I took it from a program I wrote to copy all files matching pattern in a folder tree to a single destination folder.  If you get an error it's probably the WinRar command line. You may have to fix the switches.

edit: code in previous post added InputBox if no command line filename given. So just double click if you prefer.

Navigation

[0] Message Index

[*] Previous page

Go to full version