Go Back   FlashFXP Forums > > > >

! Requests Need a script or some sort of cool .bat file ? Ask here!

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-14-2004, 01:55 PM   #1
Scuttle
Junior Member
FlashFXP Registered User
 
Join Date: Apr 2004
Posts: 6
Default [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?
Scuttle is offline   Reply With Quote
Old 04-14-2004, 04:26 PM   #2
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default

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
mr_F_2 is offline   Reply With Quote
Old 04-14-2004, 05:04 PM   #3
Scuttle
Junior Member
FlashFXP Registered User
 
Join Date: Apr 2004
Posts: 6
Default

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?
Scuttle is offline   Reply With Quote
Old 04-15-2004, 01:10 AM   #4
ADDiCT
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Aug 2003
Posts: 517
Default

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...
ADDiCT is offline   Reply With Quote
Old 04-15-2004, 07:34 AM   #5
Scuttle
Junior Member
FlashFXP Registered User
 
Join Date: Apr 2004
Posts: 6
Default

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.
Scuttle is offline   Reply With Quote
Old 04-15-2004, 10:40 AM   #6
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

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 /...
Mouton is offline   Reply With Quote
Old 04-15-2004, 10:48 AM   #7
Scuttle
Junior Member
FlashFXP Registered User
 
Join Date: Apr 2004
Posts: 6
Default

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
Scuttle is offline   Reply With Quote
Old 04-15-2004, 11:18 AM   #8
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

Would work indeed.
Hope u got some good batch-files know-how. This isn't an easy one.
Mouton is offline   Reply With Quote
Reply

Tags
directory, file, send, structure, tar

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

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 10:23 PM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)