PDA

View Full Version : [Filled] Tar/Rar packing script


PopWeasel
05-31-2004, 05:14 PM
Ok I'm pretty sure this doesn't exist already cos I looked and didnt find nthn. I tried to do this myself already but I dont know the proper cookie variable to pass "all files in current dir" to the script..

What I'd like to do is have a cmd, 'SITE TAR' for instance, which will tar all files in current dir. This will allow certain users with proper perm flag to do this without giving them full root axx to the dedi. The farthest I got was that it works good, except that it tars all files in the ioFTPD/system dir. :o
Thx.

PopWeasel
06-01-2004, 12:30 AM
By the way, rar format is also ok. I said tar only because it's a free util. And perhaps easier to do this with?

neoxed
06-01-2004, 01:37 AM
You could easily accomplish this using a batch file. For example:

dir /a /b > files.lst
rar a myarchive.rar @files.lst
del /f file.list

Perhaps this thread may be of interest to you as well. http://www.ioftpd.com/board/showthread.php?s=&threadid=1670

PopWeasel
06-02-2004, 03:35 PM
I tried all the methods listed and the results are either printing the rar help file to the status window (meaning the proper parameters were not passed to rar.exe) or a *.rar file being created in ioFTPD/system dir with the contents of that dir in it. :rolleyes: I still cannot get the parameter for "all files in current dir" passed to rar.exe correctly. Even rar "this highlighted dir" would work but I can't get that passed to rar.exe as the proper parameter either. =\

PopWeasel
06-05-2004, 04:36 PM
Ok, this is what I have at this point. Maybe someone can see what I'm doing wrong.

[FTP_Custom_Commands]
#Rar
rar = EXEC ..\scripts\Rar\rar.bat

rar.bat:
dir /a /b > files.lst
..\scripts\Rar\Rar.exe a myarchive.rar @files.lst
del /f files.lst

[R] site rar My.All.Time.Fav-ReLZ
[R] 200-
[R] 200-C:\ioFTPD\system>dir /a /b 1>files.lst
[R] 200-
[R] 200-C:\ioFTPD\system>..\scripts\Rar\Rar.exe a myarchive.rar @files.lst
[R] 200-
[R] 200-RAR 3.30 Copyright (c) 1993-2004 Eugene Roshal 22 Jan 2004
[R] 200-Registered to - User of World -
[R] 200-
[R] 200-Creating archive myarchive.rar
[R] 200-
[R] 200-Adding .ioFTPD  0% OK
[R] 200-Adding files.lst  0% OK
[R] 200-Adding ioFTPD.exe  1% 2% 4% 5% 6% 7% 9% 10% 11% 13% OK
[R] 200-Adding ioFTPD.ini  13% OK
[R] 200-Adding php4ts.dll  15% 16% 17% 19% 20% 21% 23% 24% 25% 27% 28% 29% 31% 32% 33% 35% 36% 37% 39% 40% 41% 43% 44% 45% 47% 48% 49% 51% 52% 53% 55% 56% 57% 59% 60% 61% 63% 64% 65% 67% OK
[R] 200-Adding tcl84t.dll  69% 70% 71% 73% 74% 75% 77% 78% 79% 81% 82% 83% 85% 86% 87% 89% 90% 91% 93% 94% 95% 97% 98% 99%100% OK
[R] 200-Done
[R] 200-
[R] 200-C:\ioFTPD\system>del /f files.lst
[R] 200 Command successful.

I now have a file called myarchive.rar in my C:\ioFTPD\system dir comprised of the contents of that dir.

neoxed
06-06-2004, 04:25 PM
Well you have to CD to the current directory, I was just giving you an idea in my previous post. Try this batch file, it works for me.
@echo off
cd /d %SYSTEMPATH%
echo RARing Current Directory...
echo !detach 0
dir /a /b > .ioFTPD.rarlist
"C:\Program Files\WinRAR\rar.exe" a -m0 -x.ioFTPD.* !Archived.rar @.ioFTPD.rarlist
del /f .ioFTPD.rarlist
exit 0
Notes:
- Make sure you have SYSTEMPATH=%[$path] in your /etc/ioftpd.env.
- Change the path to your rar.exe if it's located elsewhere.
- I used the -m0 switch to avoid compressing the directory, it's much quicker this way.

PopWeasel
06-06-2004, 10:02 PM
This is great but something weird now. I have two ioFTPD test setups and it works flawless on one but still rar's the contents of ioFTPD/system/ on the other one. The only difference between them is the one it doesn't work on has a multi-volume vfs (meaning that site has root dir on c: and all parent dirs on another hdd) and the one it works on the vfs is all on the c: drive. Both have the SYSTEMPATH=%[$path] variable in ioftpd.env. Is there anything about this script that would make it not work on multi-volume vfs ftp's? If so I'll understand, if not I wonder why it doesn't work on the other one..

neoxed
06-06-2004, 10:18 PM
Whoops, I forgot the /D switch on the CD command to change to directories that are on different drivers. Otherwise it would only work on the drive that ioFTPD.exe is on.

Updated the above thread.

PopWeasel
06-06-2004, 10:58 PM
:D I feel like a kid on Christmas. Thx NeoXed, it's working flawless for me now. Just what I wanted. :banana:

This [REQ] has been [FiLLED]. ;)

neoxed
06-06-2004, 11:03 PM
No problem, glad I could help. :)

PopWeasel
06-15-2004, 04:09 AM
Ok it looks like it works fine on XP but not Win2k for some reason. Does Win2k have a different value for the %SYSTEMPATH% env var or .. ?