• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Save File in UNC Path  RSS feed

 
Kevin Valencia
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Would like to know if there's a way for java to be able to save a file in a specified UNC path?

Thanks in advance!
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried it? The java.io.File documentation indicates that it can be done.
 
Kevin Valencia
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joe! Tried it! At first it gave "invalid escape sequence" error when i used "\\path\folder", it should've been "\\path\\folder". Thanks again.
 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, it should have been \\\\path\\folder.
As you probably know, in Java \ is used as an escape character. To print the character \, you'll need to escape that too to \\. That's why the above has four \'s at the start - this is actually just two escaped \'s.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!