• 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

File.renameTo does not work on Ubantu Linux 9.X version

 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Has anybody tried this command method on Linux plateform? The same code works on Windows.

Work around could be copy the file to archive folder and then remove from source folder.
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's weird. In my programs I've always entered the path with the backslash.

 
Sheriff
Posts: 22781
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

Geoff Jefferson wrote:In my programs I've always entered the path with the backslash.



This is LINUUUUUUUUUUUUUUUX!!!
sorry, couldn't help it
But seriously, Linux uses / instead of \ so that's definitely not the problem.

Vikas, do you have enough rights on both the source folder (/home/CSVFileParsing/Source), destination folder (/home/CSVFileParsing/Archive/) and their shared parents (/home/CSVFileParsing/ and /home/). In other words, can you move the file from the command line:
If not then you can try in Java all you want, but the file system is holding you back.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another possibility: Is one of those directories on a separate filesystem? renameTo() won't work in that case, you'll have to move (i.e., copy/delete) the file.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spot on Rob. It's indeed permission issue.

Thank you Guys.
 
Rob Spoor
Sheriff
Posts: 22781
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

Ernest Friedman-Hill wrote:Another possibility: Is one of those directories on a separate filesystem? renameTo() won't work in that case, you'll have to move (i.e., copy/delete) the file.


Not quite. I have successfully used renameTo on Windows between different partitions, and even with network shares.
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But if it's on a Linux partition which the user doesn't have "write" permission on . . .
 
Rob Spoor
Sheriff
Posts: 22781
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
Then it's a rights issue, as I first suspected and is confirmed by Vikas. It has nothing to do with the remote-ness of the file system.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic