• 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

Moving file to specific folger

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
this is my first post. I have a task in hand. I got to transfer a .zip file which i receive through another method and store it in a folder structure accordingly. The problem is, I am having trouble with moving this file to the folder. Can anyone help me here?

And while making a new directory, cant several new folders be created at once? What i mean is that, for instance, make a new folder "C:/test/test1/test2" where test,test1 and test2 dont exist? Do we have to create one folder at a time until reaching the final folder?(test2).

Kindly reply.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the following two methods:
java.io.File.mkdirs() - note the trailing s
java.io.File.renameTo(java.io.File)

The latter does not merely rename, but can also move files. The extent as to where you can move it may depend on your operating system, but in Windows XP I've been able to move files across partitions, and if I remember correctly even to remote shares.
 
Raj Miandad
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot.....it works perfectly fine
 
This tiny ad is suggesting that maybe she should go play in traffic.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic