Version 8 of FAQ: HTTP/FTP etc

Updated 2005-03-01 02:49:40 by MG

Why Does My File Change From Read-Only Mode To Non-Read-Only Mode, When I FTP It?

I am trying to ftp a file using TCL. The file is in a readonly mode in my source directory. but after i do a ftp, the file changes to non readonly mode (something i do not want .. i still want the file to be readonly).. i am using dos ftp .. any pointers will be aqppreciated. Ashish

March 3rd: It sounds like that's a bug in the ftp package. Whether this is the correct/best solution, I'm not sure, but you could cache the readonly value and reset it later with something like...

  set ro [file attributes $filename -readonly]
  <insert FTP code here>
  file attributes $filename -readonly $ro

2004/10/26 - e0richt

I don't believe that FTP is supposed to preserve file modes. I had a similar problem working on a RS/6000 box. You will either have to set the file attributes after transfer or if you had a lot of files you could ftp a .tar file which will preserve file attributes when it is unrolled.


Is there any command we can send an FTP server and have it tell us whether it supports resuming?

According to RFC 959 [L1 ] you can use FTP command 'REST'. Not every FTP server implements this command!

MG I don't know whether this is a solution that would work everywhere, but when I do

  package require ftp
  set handle [ftp::Open $server $user $pw]
  set code [lindex [::ftp::Quote $handle REST] 0]

on my FTP server, code is set to 501 (the ::ftp::Quote command returning '501 No restart point'), whereas

  set code [lindex [::ftp::Quote $handle JIBBERISH] 0]

sets code to 500 (Unknown command).


Is there any Tcl-only method to check whether I have an Internet connection active at the moment?

You can try to open a connection to a well known server. For instance: www.google.com port 80.


[Category FAQ] (an illustration of a less cluttered format)