hi,
iirc there used to be an unrar script for ftprush. unfortunately I am not capable to write one myself. can anybody please explain how to automatically unrar a finished download or provide their script maybe?
thx in advance.
Unrar script?
-
- Posts: 1
- Joined: Wed Apr 25, 2012 1:23 pm
Re: Unrar script?
I am also interested in something like this.
Can anyone help or show in right direction?
Can anyone help or show in right direction?
-
- Posts: 11
- Joined: Mon Oct 31, 2011 11:20 am
Re: Unrar script?
After a few hours of playing around with the FTPRush-Scripts, I've got this for you:
Modify the paths and place this somewhere in FtpRush.Pac:
The way to make it visible in the menu is described in FtpRush.Pac (please ask if you have problems doing this).
It just calls AutoUnRAR.Bat:
You also have to modify the paths here.
(I think...) you need a registered version of winrar to use the command line version of rar.exe!
You also need a warten.exe which is just a system wait function ... (I could provide mine if it's really necessary)
==========
EDIT: I just noticed that my batch file won't work with a non-german command line.
This line: is doing the following things:
It executes "dir", which is just listing the directory.
It searches through the output for a line containing "Datei(en)".
This is just done by "dir^|Find "Datei(en)"" so far.
In this line, you can find the size of all files inside of this directory in column no. 3.
The 3rd column of each filtered line is being saved in %%i which is being saved in %SIZE%.
Long story short: modify "Datei(en)" to make it work on a system of your language.
==========
Modify the paths and place this somewhere in FtpRush.Pac:
Code: Select all
//------------------------------------- ---- --- - -
// AUTOUNRAR(SENDER)
// starts AutoUnRAR.BAT RushApp.UI.Selection.TargetLocalPath
// that extracts a containing *.RAR-File when there is no
// change in the FolderSize for about 10 seconds.
//------------------------------------- ---- --- - -
procedure AUTOUNRAR(Sender);
var TargetPath;
begin
RushApp.UI.Selection.Prepare
TargetPath := RushApp.UI.Selection.TargetLocalPath;
ShellExecuteCommand('C:\Windows\system32\cmd.exe','/C K:\Bat\AutoUnRAR.bat ' + TargetPath,'',0);
end;
It just calls AutoUnRAR.Bat:
Code: Select all
@echo off
echo =====[ Entpacke die *.RAR-Datei sobald sich der Ordner nicht mehr ändert ]=====
echo.
echo Start mit 1: %1%
echo.
%~d1%
cd %~dp1%
echo %~dp1%
echo.
echo %TIME%: Überprüfe Ordner
set oldsize=0
set i=0
:Start
K:\Bat\Sys\warten.exe 1000 > NUL
SET SIZE=0
For /F "tokens=3 Delims= " %%i in ('dir^|Find "Datei(en)"') Do SET SIZE=%%i
if %size%==%oldsize% goto nochange
echo %TIME%: %SIZE%
set oldsize=%SIZE%
set i=0
goto Start
:nochange
set /a i=%i%+1
echo %TIME%: %SIZE% unverändert zum %i%. mal
if %i%==10 goto unrar
goto Start
:unrar
SET FILE=0
For /F "tokens=4 Delims= " %%i in ('dir^|Find /i ".rar"') Do SET FILE=%%i
echo RAR-File: %FILE%
echo Path: %~dp1%FILE%
echo %TIME%: Extracting!-------------------------------------------------------
K:\Bat\Sys\Rar.exe e %~dp1%FILE%
echo %TIME%: Done!-------------------------------------------------------------
pause
(I think...) you need a registered version of winrar to use the command line version of rar.exe!
You also need a warten.exe which is just a system wait function ... (I could provide mine if it's really necessary)
==========
EDIT: I just noticed that my batch file won't work with a non-german command line.
This line:
Code: Select all
For /F "tokens=3 Delims= " %%i in ('dir^|Find "Datei(en)"') Do SET SIZE=%%i
It executes "dir", which is just listing the directory.
It searches through the output for a line containing "Datei(en)".
This is just done by "dir^|Find "Datei(en)"" so far.
In this line, you can find the size of all files inside of this directory in column no. 3.
The 3rd column of each filtered line is being saved in %%i which is being saved in %SIZE%.
Long story short: modify "Datei(en)" to make it work on a system of your language.
==========