! Requests Need a script or some sort of cool .bat file ? Ask here! |
04-14-2004, 01:55 PM
|
#1
|
Junior Member
FlashFXP Registered User
Join Date: Apr 2004
Posts: 6
|
[REQ] On the Fly Archiving Script
Ok, some unix-based sites I have been on has had the ability to archive and send a selected directory on the fly, you send "RETR foldername.zip" for example, and the server will send you a file with the folder 'foldername' all zipped up.
Or as one site puts it in one of their welcome-messages:
Quote:
It is also possible to tar and eventually compress or gzip a
directory structure by adding .tar, .tar.Z or .tar.gz to the directory-name.
For example, the directory structure (including the files) under
/pub/gnu/gimp can be retrived as a single tar file using the command
'get gimp.tar' (obviously you'll have to 'cd /pub/gnu/' first).
If you you want a compressed tar file, simply use 'get gimp.tar.Z'
|
What would the easiest way to accomplish this with ioFTPD?
|
|
|
04-14-2004, 04:26 PM
|
#2
|
Senior Member
Join Date: Jan 2004
Posts: 203
|
on pre RETR, run a script to see if the file exists that is requested, if not (but the directory with the same name minus the extention exists) then tar it up and send it off?
something would have to be trigged to del the tarball after the file is downloaded
|
|
|
04-14-2004, 05:04 PM
|
#3
|
Junior Member
FlashFXP Registered User
Join Date: Apr 2004
Posts: 6
|
Quote:
Originally posted by mr_F
on pre RETR, run a script to see if the file exists that is requested, if not (but the directory with the same name minus the extention exists) then tar it up and send it off?
something would have to be trigged to del the tarball after the file is downloaded
|
Hmm, this looks like an excellent place to start. I checked ioftpd.ini and found [FTP_Pre-Command_Events]. The RETR-command was not entered here (using a basic installation). Can I just add "RETR = my-bat-file.bat" here?
Also, I take it I could use another bat-file on the OnDownloadComplete-event and delete the file?
|
|
|
04-15-2004, 01:10 AM
|
#4
|
Senior Member
FlashFXP Beta Tester ioFTPD Scripter
Join Date: Aug 2003
Posts: 517
|
be aware of this problem:
/abc/
-> no abc.zip exists
RETR abc.zip
-> /abc/ gets zipped into abc.zip
Now u have a file /abc/abc.zip or /abc.zip
(not sure where u want to see the file placed).
After the file has been sent, how do u determine if the file existed before the RETR command?
Timestamp? might be innacurate if it's a large dir and a slow transfer...
|
|
|
04-15-2004, 07:34 AM
|
#5
|
Junior Member
FlashFXP Registered User
Join Date: Apr 2004
Posts: 6
|
If the file does not exist, i.e you are making an on the fly zip, you create a file somewhere else named folder.zip-MARKER, then after the transfer is done you check for this file, and if it exists, delete the zip and the marker-file.
|
|
|
04-15-2004, 10:40 AM
|
#6
|
Posse Member
Ultimate Scripter ioFTPD Administrator
Join Date: Dec 2002
Posts: 1,956
|
If the client sends RETR somefile.ext, you NEED a file somefile.ext in the current dir or ioFTPD won't be able to send it. You can't tell io to send some other file instead of the one asked in the RETR command.
CWD /
RETR somedir.zip
-> PRE RETR = ..\scripts\zipitup.bat gets called with RETR somedir.zip in parameter
-> produce a somedir.zip file in /
File is transfered
-> OnDownloadComplete = ..\scripts\cleanit.bat gets called with the filename in parameter
-> deletes the file
Same should be done OnDownloadFailed, in case the person doesn't retry the transfer. You would be left with a .zip on your /...
|
|
|
04-15-2004, 10:48 AM
|
#7
|
Junior Member
FlashFXP Registered User
Join Date: Apr 2004
Posts: 6
|
Yes, all this I am clear about, but if the person is downloading an already existing zip-file I need some way to tell. In the pre-command script I create a file named somedir.zip-DYNAMIC if the user download a created zip, then in the OnDownloadComplete script I check for the flag-file, if it exists, delete the zip, if it doesn't, don't
|
|
|
04-15-2004, 11:18 AM
|
#8
|
Posse Member
Ultimate Scripter ioFTPD Administrator
Join Date: Dec 2002
Posts: 1,956
|
Would work indeed.
Hope u got some good batch-files know-how. This isn't an easy one.
|
|
|
Thread Tools |
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
Download grinding to a halt
|
bruceh |
General Discussion |
6 |
09-07-2004 08:29 AM |
All times are GMT -5. The time now is 03:28 PM.
|