check to see if file exists via FTP - iphone

I am transferring a file via FTP and want to be able to check if that file already exists...
i guess it is using doesFileExist but can't seem to find example for doing this over FTP
i have google'd etc but can't seem to find the right answer.
can anyone help?

Two possible answers:
1) The traditional way to check for a file on an FTP server is the SIZE command - if you get a size, the file exists, otherwise you get an error and you know it doesn't exist.
2) Found some code that demonstrates a possible way to do this:
Get file size on FTP download
Hope this helps.

Related

Read log file from Google DriveFS

I would like to find the reason for a bug with an application and the Google Drive on Mac. With FSMonitor, I see that drive writes many logs in a structured_log_* file at ~/Library/Application Support/Google/DriveFS/Logs/ when I have the issue. But when I open the file it's not really readable in editor and toolbox.googleapps.com/apps/loggershark need drive_fs*.txt file and it does not contain any related log.
I see that structured_log_* are logs related to the file I open fichier test dsi2, but it is not readable.
How can I decode and read the file ?
Did you ever find an answer?
I'm looking to view the structured_log_* logs to see if it contains information on files uploaded and removed from a google drive account. Basically for auditing proposes...
But unfortunately, I can't make anything out. I have passed it through strings and sorted and it looks like the file names are contained within these logs and possibly the hashes of the files.
It would be nice to be able to decode the log properly to see whats the activity on in the log.
Thanks

Get list of files in directory on server iPhone

I am trying to get a list of the available files when from a server and be able to look at the names of the files that are available. I was looking at using the NSFileManager, but it does not seem to want to return any results when I enter a URL. I basically want it to return something like when you type "ls" into bash/terminal
Can someone lend an example of how the contentsOfDirectoryAtURL method works and what arguments I should be putting to get the desired result.
NSFileManager only works with local urls with scheme file:
How you talk to a server to access its contents depends on what protocol the server speaks.

download multiple files using SimpleFTPSample

I've been trying to figure out how to download multiple files in a row based on the SimpleFTPSample provided by apple. Basically, I'm filtering what the user can see when they browse an ftp server, but when they select a certain file type, I want it to automatically check for another file of the same name with a different extension and if it exists, download it as well. I can't seem to get this second file to download no matter what I do. It seems strange because if I select two files in a row in my tableview, it downloads both of them just fine. Any ideas?
Edit:
It's just the SimpleFTPSample from apple.developer.com, all I did was create additional NSInputStream and NSOutputStream objects and I created a new _startReceiveFile method that gets called from _startReceive if I'm downloading a file instead of getting a directory listing. _startReceiveFile is the same code for _startReceive in the file download code for the sample project, except if the file to download has a certain extension, it also downloads an additional file with the additional stream objects. Let me know if I need to clarify more or try to put together a clear example.
Well, since there were no takers, I'll just post my solution here. I've abandoned trying to download two files at once. Instead, I just keep the ftp browsing window open and only handle the opening of the file once both files have been downloaded (user has clicked on each one separately). It's not what I wanted, but it will work, at least until I can figure out how to get two files with one request.

ftp from device

When i send a .txt file via ftp on the simulator it works fine. but when i send it from the device, the .txt file gets send, put not the contents of it.
Can anyone help?
You asked a similar question the other day (and didn't mark an answer.)
How are you trying to upload the file via FTP? Please show us some code.
As I said in my answer to your other question, an easy way to upload a txt file via ftp would be to use some pre-canned FTP library. This one seems to be good, and they have examples on their web page of how to upload files with just a few lines of code:
http://code.google.com/p/s7ftprequest/

Uploading and downloading via ftp with iPhone SDK

Could anybody explain to me the process of uploading to and downloading form and ftp server with the iPhone SDK. If you could just point me in the right direction (e.g. documentation etc.). How difficult is a task like this?
Thanks in advance.
You can use this. It support all the basic ftp operations:
Download file
Upload file
Delete file
Delete directory
Create directory
List directory contents
[DISCLAIMER] I am the developer of the library, I needed a ftp library too in the past and came over this answer. However, I decided to write one myself because s7ftprequest didn't support at that point several operations that I needed.(like download or list directory)
Try this Simple FTP Download
The Apple documentation will provide far more info in general than I could. Have a look at:
http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/CFFTPTasks/CFFTPTasks.html#//apple_ref/doc/uid/TP30001132-CH9-SW1
which details the FTP information you need. If you prefer a PDF with all the networking info in it, have a look at:
http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/CFNetwork.pdf
In this, you'll be particularly interested in Chapter 5. Both detail working with FTP sites, including uploading, downloading, retrieving directory listings, etc.
s7ftprequest only for uploading files to FTP.
The below is sample code from apple
http://developer.apple.com/library/ios/#samplecode/SimpleFTPSample/Introduction/Intro.html
Limitations:
FTPS (that is, FTP over TLS)
deleting items
renaming items
other less common FTP commands
custom FTP commands
I ended up using GoldRacoon. It turns out that in iOS/objc land, there's BlackRaccoon as the original FTP client lib, then WhiteRaccoon was forked from that, and then GoldRacoon was forked from WhiteRaccoon (I think)
pod search GoldRaccoon
... will show you.
I ended up making a few changes (in my own fork) so that you can pass in a successBlock & failBlock into any request, so that block-y callers (like my classes) don't have extra work to manage the delegate callbacks. Github link (my fork): https://github.com/xaphod/GoldRaccoon