I NEED HELP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I NEED HELP

For anyone using netbeans i need help. Whole code not work because my third if condition is not valid and i can't find solution.. can someone help me with that condition.. Tnx https://code.sololearn.com/cRr0wfZ0cMMX/?ref=app

14th Dec 2019, 12:13 PM
Nebojsa Barac
Nebojsa Barac - avatar
7 Answers
+ 4
For a better understanding: Enter the path of folder. Enter the path of target folder. Put folder into target folder. If target folder does not exist create new folder. Am I correct?
14th Dec 2019, 2:03 PM
Denise Roßberg
Denise Roßberg - avatar
+ 10
Denise Roßberg The destination path must be specified first because it cannot exist before the file is copied, seems to be a problem with if-statements and their layout, as if they should be reversed? [ Edited: ] I don't know how file manipulation methods work?
14th Dec 2019, 1:55 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 4
Yes you are correct
14th Dec 2019, 2:07 PM
Nebojsa Barac
Nebojsa Barac - avatar
+ 2
Important before running this code: work only with sample files/folders or make a copy of your files/folders Btw. I did not add the option replace a file while moving/copying -> I think you should be careful with this option To keep it more simplier I only allow file to folder Btw: Files.isDirectory(path) is a very useful method. Note: I used some txt.files to try the code. If file exists and folder exists -> move file to folder If file exists and folder not -> create folder -> move file to folder For moving folder to folder you should write two methods: one for moving files, one for moving folders Hope this code helps you. https://code.sololearn.com/cDjfM82dWRR7/?ref=app
14th Dec 2019, 5:15 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
About input (I am using ubuntu): E.g. source: /home/folder/myFile target: /home/targetFolder If you would enter /home/targetFolder/myFile it would not work. Enter only path of the target folder.
14th Dec 2019, 5:23 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Can you tell me which error message you get? I need a bit time but I will check this code.
14th Dec 2019, 1:21 PM
Denise Roßberg
Denise Roßberg - avatar
0
Hello. "BUILD SUCCESSFUL" And file/folder is not copy. Sometime create Folder i javaapplication folder where i work on this project. I can send to you whole project List,Info,Rename,Delete and Create Dir work but option Copy and Move not. Tnx for your time
14th Dec 2019, 1:39 PM
Nebojsa Barac
Nebojsa Barac - avatar