Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FTP Directory creation  RSS feed

 
saravanan palanivel
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying FTP file upload in java. I'm using JFilechooser to browse files from my local machine(Windows).
and creating multiple directory in FTP server (LINUX) by using ftpClient.makeDirectory(dir1/dir2/dir3).
It creates single directory named 'dir1\dir2\dir3'. but dir2 and dir3 are sub directory of dir1.
It works in Windows FTP server.
please help to fix this issue.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the makeDirectory() method has documentation stating it creates sub directories if you give directories separated by a separator, then better try "dir1 + File.separator + dir2 + File.separatoor + dir3" instead of slashes. If there's no documentation or it didn't work I guess its the Windows OS that does the trick.
 
Nam Ha Minh
Ranch Hand
Posts: 512
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi saravanan palanivel,

If you are using Apache Commons Net API to do FTP stuff, the makeDirectory() method won't create sub directories automatically. Instead, you have to manually create the parent directory first, then the sub one, then the sub of sub one... and so on.

More information on how to make a directory on FTP server here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!