tags:

views:

348

answers:

2

I have an application that deploys game data files to different gaming consoles. If matching files on the users machine and the console have identical size and dates, they must not be re-deployed.

On Xbox, this is easily accomplished because an XDK library used to upload files on the console allows me to set the date on the uploaded files to match the dates on the user's machine.

On Ps3 however, I use an FTP service running on the console. I use WebClient.UploadFileAsync to upload files to the console. However, I cannot figure out how I can set the uploaded file's date timestamp, leaving me with only the file size to determine identical files which is unsafe.

I was wondering if there was a way to set a file's date timestamp through the WebClient interface?

A: 

WebClient will hand off ftp connections to FtpWebRequest. If you use FtpWebRequest directly you can send FTP commands to the server. The commands that are supported are defined as fields of WebRequestMethods.Ftp. One of those commands is GetDateTimestamp.

So if you construct an FtpWebRequest manually (instead of through WebClient) and send either the GateDateTimestamp or the ListDirectoryDetails command, you should be able to get the timestamp of the target file.

Arnshea
Hey said he wants to "SET" the timestamp. Not get it.
Keltex
Yeah I want to set the timestamp. I can already get the timestamp, but the datetime of the files no longer matches the dates of the files I uploaded. I think its the time of the console when the files were uploaded.
Anthony Brien
keep track of the timestamp after you've uploaded. if it's different the next time you connect then you know you need to update.
Arnshea
+1  A: 

I don't think you can use the WebClient interface for this.

There seem to be various non-standard FTP extension commands implemented by some FTP servers to support the setting of a file's last modified time. The ones I know about are:

  1. MDTM - This is the standard command for getting the a file's last modification time (as used by GetDateTimestamp()). Some servers support a set operation by specifying a timestamp argument to the command. as well as a filename.
  2. MFMT - This was defined in an IETF experimental draft MFMT, to standardise this operation and avoid the non-standard use of the MDTM command described above.
  3. SITE UTIME

If the FTP server running on the PS3 supports any of these extensions (check the result of the FEAT command), then you could use a simple socket FTP connection to issue the appropriate command to the server, after uploading the file.

Amal Sirisena