java - Move the file to other location -


i need move file other location giving differnt name. tried :

files.move(oldname, newname, options); 

i exception:

java.nio.file.nosuchfileexception: /media/sf_vboxshared/data/csv/res20150201/xx/part-r-00000-f8ed41a5-e0e1-4534-a1d9-e4d6082691db.gz.parquet -> /media/sf_vboxshared/data/csv/res20150201/res/xx.parquet 

the oldname file exists. newname dosn`t exist. (only /media/sf_vboxshared/data/csv/res20150201 part of path exist)

you /media/sf_vboxshared/data/csv/res20150201, parent directory of directory want move file to, /media/sf_vboxshared/data/csv/res20150201/xx, doesn't exist.

so have create first before moving:

path newname = ...; files.createdirectories(newname.getparent()); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -