Page 1 of 1

geeks question about FTP commands?

Posted: 24 May 2004, 09:45
by Quiff Boy
anyone used command-line FTP in anger?

i need to transfer a stack of files from a windows box to a unix box (its a hp box if that matters) via command-line FTP.

i have a .bat file that logs into the ftp server and runs the following commands:

Code: Select all

prompt
literal site umask 012
mput c:\ftp\Sending\*.log
the PROMPT command toggles the command prompt
the LITERAL command sets the default CHMOD values for the files about to be sent
the MPUT command sends the files

i need to preserve the datestamp of the files, but at the moment they seem to end up with the transfer-time set as their last-modified date.

i want to keep the original datestamp. :|

any ideas how i do this? i've seen it done with ftp client software (ie: a checkbox you can tick to preserve the date/timestamp) but i'm using the microsoft command line ftp client and cant seem to be able to do it.

is it a server-side setting (ie: a LITERAL SITE command?) or is it a client side command (ie: a switch or something i need to put on the end of the MPUT line?) :?:

bloody thing. :urff:

Posted: 24 May 2004, 10:18
by Karst
Is there no way you can just dump it on the server?

8)

Posted: 24 May 2004, 10:38
by Quiff Boy
Karst wrote:Is there no way you can just dump it on the server?

8)
nope, gotta be ftp.

firewalls, checkpoint nonsense etc :roll:

after further digging, its looking like you cant preserve timestamps during upload... only download (which used a slight frig to ascertain the remote file's timestamp and then does a TOUCH or similar on the local file)

the solution would appear to be to TAR the local files up (TAR preserves timestamp info), ftp the TAR file, then use a LITERAL SITE command to UNTAR the log files and then delete the TAR.

:urff:

Posted: 24 May 2004, 11:03
by Karst
Didn't know TAR did that. I know that when zipping it and dumping it on my Win2000 server the date remains. Not that I'm really bothered about that. Lucien might know more about this btw.

8)

Posted: 24 May 2004, 11:13
by hallucienate
Karst wrote:Didn't know TAR did that. I know that when zipping it and dumping it on my Win2000 server the date remains. Not that I'm really bothered about that. Lucien might know more about this btw.

8)
All my servers run Linux. I maintain a couple of Win 2000 servers reluctantly, but that mostly involves doing the Windows Update once a week. :roll: :roll:

tar can be very useful (it also keeps file permissions), but we don't use FTP very much as most of our uploads are linux to linux we use UUCP or scp. :von:

Posted: 24 May 2004, 11:31
by jenzi-benzi
your TAR solution is good as long as you can do tar commands via ftp, which i think is impossible, besides S-FTP (kinda SSH) :wink: