File system access in Squeak

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

File system access in Squeak

Navodit Kaushik
Hi
 
Can anyone suggest a good package for file system access? Someone suggested Rio but I am not sure how to install it as it does not show up in the Package loader...
 
I want to be able to work with the files on a ftp server and am not sure what to use for this. If possible an example script to connect to a ftp server and work with the files therein would be really helpful. Thanks
 
Navodit
 
 


Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.

Reply | Threaded
Open this post in threaded view
|

Re: File system access in Squeak

Karl-19
Navodit Kaushik wrote:

> Hi
>  
> Can anyone suggest a good package for file system access? Someone
> suggested Rio but I am not sure how to install it as it does not show
> up in the Package loader...
>  
> I want to be able to work with the files on a ftp server and am not
> sure what to use for this. If possible an example script to connect to
> a ftp server and work with the files therein would be really helpful.
> Thanks
For basic ftp, FileList can do that.

Edit this info in a Workspace , your ftp should show up in the FileList:

"Please fill in the following info, then select all text and choose DoIt."

    | aa |
    self flag: #ViolateNonReferenceToOtherClasses.
    aa _ ServerDirectory new.
    aa server: 'st.cs.uiuc.edu'.    "host"
    aa user: 'anonymous'.
    aa password: '[hidden email]'.
    aa directory: '/Smalltalk/Squeak/Goodies'.
    aa url: ''.    "<- this is optional.  Only used when *writing*
update files."
    ServerDirectory addServer: aa named: 'UIUCArchive'.  "<- known by
this name in Squeak"

Karl

Reply | Threaded
Open this post in threaded view
|

Re: File system access in Squeak

Dominic Letz
In reply to this post by Navodit Kaushik
Try using the FTPClient class it is already in the base image. It is very  
easy to use. Here a little example uploading a file

uploadFtp
        | client |
        [StandardFileStream fileNamed: 'myfile.zip' do: [:fileStream |
        client := FTPClient openOnHostNamed: 'ftp.mywebsite.com'.
        client
                loginUser: 'user' password: 'password';
                changeDirectoryTo: 'httpdocs/temp';
                binary;
                putFileStreamContents: fileStream as: 'myfile.zip'
        ]] on: Error do: [
                self inform: 'There was an error.'
        ]

Am 17.04.2007, 19:20 Uhr, schrieb Navodit Kaushik <[hidden email]>:

> Hi
>  Can anyone suggest a good package for file system access? Someone  
> suggested Rio but I am not sure how to install it as it does not show up  
> in the Package loader...
>  I want to be able to work with the files on a ftp server and am not  
> sure what to use for this. If possible an example script to connect to a  
> ftp server and work with the files therein would be really helpful.  
> Thanks
>  Navodit
>
> ---------------------------------
> Ahhh...imagining that irresistible "new car" smell?
>  Check outnew cars at Yahoo! Autos.



Reply | Threaded
Open this post in threaded view
|

Re: File system access in Squeak

Göran Krampe
In reply to this post by Navodit Kaushik
Hi!

> Hi
>
>   Can anyone suggest a good package for file system access? Someone
> suggested Rio but I am not sure how to install it as it does not show up
> in the Package loader...

AFAIK Rio is still being developed by Keith, probably not "ready" yet.

>   I want to be able to work with the files on a ftp server and am not sure
> what to use for this. If possible an example script to connect to a ftp
> server and work with the files therein would be really helpful. Thanks

In fact, ServerDirectory/FileDirectory and friends can work with ftp
servers out-of-the-box in Squeak. I don't have pointers or snippets right
now but if you still fail to find anything, cc me privately and I can dig
something out.

I would guess you can easily find example code in Monticello - since it
can use ftp repos for snapshots.

>   Navodit

regards, Göran