how to send small files(<10Kb) of large quantity(300,000 files) to external drive quickly? - file-transfer

I have lots of javascript files(~300,000) which has size of <1Kb. I'm trying to tranfer it to external harddrive. It is taking days to transfer. Please let us know if there is any quick way to do this.

Put them in a compressed archive, like a .zip file, then transfer that.

Related

File Uploading in Sakai

I want to know if there is a 'right' way to make file uploads through custom tools.
I've seen the https://confluence.sakaiproject.org/display/BOOT/File+Uploads+with+RSF guide and it seens ok, but It stops with the file in memory with no further info. I can built a random file upload code but I want to make it Sakai-friendly (Using ContentHosting and Resources service?)
Any hints?
Thanks
The link you provided for the first part is a good example of how to get the upload initially processed. Going through RequestFilter will get your files validated, but you can use whatever method you want to upload it.
For the second part, I'd look at the ContentHosting webservice (createContentItem) for an example of how to add a file from a byte[] in memory after you've uploaded it.
These methods in ContentHostingService also accept InputStream as a parameter as of 2.7 (KNL-325), so you don't have to store the entire file in memory and can stream it as you're uploading, which you should do if the files are of any reasonable size.

Download and unpack a *.tgz file to a subdirectory of the Documents directory

There very well may be an answer to this already on SO, but I'm not familiar enough with compression formats to know if they're applicable to my case. So here's what I need:
1) Download a *.tgz file that is greater than 200MB.
2) Unpack it to a specified subdirectory of the Documents folder.
I know how to make the connection and begin downloading. But how do I download to an actual file (rather than storing it in memory), and once this download is complete how do I unpack it to my desired location?
To save the downloaded data to a file, see this SO-question and answer(s): The easiest way to write NSData to a file
To uncompress .tgz-files, see this question and answer(s): "Untar" file on iPhone
To download large files, see this question and answer(s): How to download large files using objective c on iphone
(Google is an awesome tool, really.)
Just as a sidenote, an app shouldn't download 200MB of data. It is time- and bandwith consuming and may cause Apple to reject your app.
Forget NSURLConnection; use ASIHTTPConnection (google it) which has an easy save to file option. (And resumes failed downloads too)
I don't know the answer to tar/gzip. My application uses zips instead and http://code.google.com/p/ziparchive/wiki/PageName does the trick.

downloading big size(In MB) .txt files using NSURLConnection

I'm downloading .txt files using NSURLConnection. Small size (in KB's) files are downloading perfectly but when i downloading big size(In MB) file, it always downloaded with corrupt data.
Sometimes big size .txt files are downloaded. But when i fetch those .txt file programmatically, it shows null content in it.
Please help.....
Thanks in advance.
You should check out the ASIHTTPRequest wrapper classes for HTTP request. They make the download of big sized files easy as they allow to download the files directly to the file system. I am currently using these wrapper classes on a project and I can assure you that they make your life a lot easier.

Valid file types for iCloud?

I find many similar question but i didn't get solution for this.
Is it possible to upload some file like image, document, zip file to upload on iCloud programmatically?
See table 4-1 in the documentation:
How do you manage the data? Manage files and directores using the
NSFileManager class. Open, close, read, and write files using standard
file system routines.
So if you can create a file, you can store it in iCloud. But remember there's a finite, relatively small amount of space available.
iCloud can handle all kinds of files. So if you want rot use an obscure file format or invent your own, go for it. It only can to be converted into a byte stream/NSData, but then again, what isn't?
Check this tutorial walkthrough app. It shows how to create, modify and delete files for iCloud.
http://github.com/lichtschlag/iCloudPlayground

save data downloaded from internet

here's the thing: I download a bunch of data in JSON format. I put that into an array of dictionaries. Then, I save to disk. One dictionary stores a link to some image. What I would like to do is to store also the actual image (not the link!) along with rest of the data. How would you start? Which way to go?
I would download the image and save the local path alongside the URL path.
However, if you're going for one big file, you could always base64-encode it.
I think using the filesystem directly and saving your local path would be more efficient and effective than one monolithic file, as you'll save a lot of parsing and encode/decode time.
I suggest you to start from this tutorial : SimpleFTPExample