• 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 Moving on Mounted Devices (NFS/ Samba)

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

An Interesting Observation: We can move files from Java using renameTo() function, one of my solution is distributed in 3 tiers. First 2 on linux (NFS mapping) and 3 tier is on windows (Samba mapping). When I try to move files from one linux system folder to other (NFS) or linux system to windows system folder(samba), it doesn't returns any errors but files are not transmitted.

Any clues?

Regards,
Zeeshan
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you move a file on a single device, only an entry in a filetable needs to be changed, for example from /mnt/hdf4/foo/bar.txt to /mnt/hdf4/bar/bar/bar/bar.txt. The file itself isn't read or written. It's just renamed.

If you try to write it to a different device, it needs to be read and written, and can't just be renamed.
 
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
renameTo() fails by returning "false"; it will generally fail when, as Stefan says, you try to rename something onto another device. You must always check the return value of "renameTo()" and fall back to bytewise-copying on failure.
 
Water! People swim in water! Even tiny ads swim in water:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic