0

How to move one file (eg. .txt or .jpg) to one particular folder in Java? I want line by line explanation. I know InputStream and OutputStream read from InputStream and write to OutputStream. But how do they take bytes etc.? Any ideas?

user7116
  • 63,008
  • 17
  • 141
  • 172
tejas26389
  • 73
  • 1
  • 1
  • 8

1 Answers1

3

You wouldn't do it by reading/writing the contents of the file. Look at the File Javadoc. You can use the File class to rename and move individual files at a file level -- without having to access the contents of the files. In particular, see the renameTo and mkdirs methods of File.

QuantumMechanic
  • 13,795
  • 4
  • 45
  • 66