Hi all, I need to read some folders from directory on machines inside a local network and copy them in another location,In fact I'm deploying some folders to a central location manually, I'm wondering if I should use FileInputStream and something like this? I tried this one and I can read files on my local machine, here's the code I used for reading all filenames in a directory:
but when I want to read from a directory on another machine in local network I got this error:
We can't tel just which line threw that error from here, but I'd guess it's because of this bit from the doc on File.listFiles(): Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
What's the filename string you're passing to new File()?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Thank you for your attention, the string I've passed to the new file() method for reading from local network is something like this: "\\mycomputerName\folderName" which mycomputerName is name of my computer in network and folderName is name of the folder i want to read list of files in.I really have no idea if such addressing across a local network could be correct or there's another way?
Can the user that is running the program access this folder?
And in Java, do you specify it as follows: "\\\\mycomputerName\\folderName"? You'll need the 4 backslashes at the start, because \ is the Java escape character and \\ will indicate only a single backslash.