• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FTP Directory creation

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic