java - How to move folder and files? -
my program uses file database , wondering how move folder without deleting files within folder. using java. when press button them move specified location. code on button looks this:
private void uploadbuttonactionperformed(java.awt.event.actionevent evt) { // todo add handling code here: projectinfo.documenttitle = filename.gettext(); projectinfo.movefilelocation = filespecificlocation.gettext(); string name = usernametext.gettext(); signup.filetomoveto = "c:\\cloudaurora\\" + name + "\\"; string docttl = projectinfo.documenttitle; // docttl.renameto(new file(signup.filetomoveto)); projectinfo.documenttitle = filename.gettext(); projectinfo.movefilelocation = filespecificlocation.gettext(); string name = usernametext.gettext(); signup.filetomoveto = "c:\\cloudaurora\\" + name + "\\"; string docttl = projectinfo.documenttitle; system.out.println(projectinfo.documenttitle); system.out.println(signup.filetomoveto); }
if awesome. have looked way couldn't figure out how
i hope per case, have mentioned source file , destination file correctly. below code should move folders along file.
file srcfile = new file(docttl); file destfile = new file(signup.filetomoveto); /* handle ioexception below line */ files.move(paths.get(srcfile.getpath()), paths.get(destfile.getpath()), standardcopyoption.replace_existing);
Comments
Post a Comment