FTP client : How to change working directory

by Guru » Fri, 23 Apr 2010 08:02:05 GMT

Sponsored Links
 Hi friends,
I am beginner to android. I am trying to develop FTP client in
android. I am unable to change the working directory.
I am using FileZilla FTP server.
I want to upload one file (samplefile.txt) to FTP server. So,

Step 1: I created this file using
FileOutputStream fOut =
OutputStreamWriter osw = new OutputStreamWriter(fOut);

and I confirmed this file got created in "/data/data/com.xyz.Hello/

Step 2: open and connect to ftp server

ftp.connect("107.108.yy.xx", 4000);
ftp.login(username, password);
ftp.port(ftp.getRemoteAddress(), ftp.getRemotePort());

Step 3: Store samplefile.txt in FTP server

InputStream input;
                                String path = new
                                Log.i("FTP", path);
                                input = new FileInputStream("samplefile.txt");



Problem: In the step 3, when I do  String path = new
java.io.File(".").getCanonicalPath(); I am getting root directory "/".
But my file is in "/data/data/com.xyz.Hello/files/samplefile.txt". So
I should do change working directory to "/data/data/com.xyz.Hello/
files". But I am not getting how to do this in android? Please help me
to know how to change the working directory. and also let me know if
there is any code help on creating FTP on android.


Other Threads

1. Android DRM Guide?

I've heard that there is guide about Android DRM from google.
Does anyone know about this?
Is there any document or link to this guide?

unsubscribe: android-porting+unsubscr...@googlegroups.com

2. Iseng, downgrade spica

Iseng mau downgrade spica dari 2.1 ke 1.5 :d

Ada yg tahu caranya ? 
Happiness is our precious gift in life

"Indonesian Android Community [id-android]" 

3. Install dari adb ke hp

4. Indosat goes 42Mbps

5. unable to resolve MapActivity to a type?

6. Share : app andcam3D

7. Coke filling into a glass using OpenGL ES