✅ I cant combine folder paths
I was trying to combine folder path with strings with that code
But when i click the button, baseFolderPath is still use same path, i need to combine "ilce, mahalle,klasorAdi" strings to reach my folder path. How can i make?
5 Replies
it use like that without adding any path
"C:\Users\ASUS\Documents\LIHKAB\LIHKAB_3100-800"
i need paths like that
"C:\Users\ASUS\Documents\LIHKAB\LIHKAB_3100-800\ISLEM\ILCE\MAHALLE\klasorAdi"
and i need 1 more thing
"C:\Users\ASUS\Documents\LIHKAB\LIHKAB_3100-800\ISLEM\ILCE\MAHALLE\klasorAdi\Note.txt"
So, it's actually working and your code is missing the filename
Note.txt
, did I get that right?My code is working, but only the folder path in "baseFolderPath" is visible. In my code, there is a place where I display the content of "folderPath" with MessageBox, and there the code tells me this:
Program location: C:\Users\ASUS\Documents\LIHKAB\LIHKAB_3102-811\
The program only shows me this location. I need a way for the other strings (ilce, mahalle, klasorAdi) that I added to "folderPath" to be included as well. Because in the continuation of the code;
I want to delete both the folder and the
"Not.txt"
files inside the folder. However, I cannot update the file location with this code. The result is always the same:
Program location: C:\Users\ASUS\Documents\LIHKAB\LIHKAB_3102-811\
i tried to edit string when i put actual text
string ilce = "arsuz"
and changed messagebox's code ("Program location: " + ilce...
its works but when i put duzenleIlce.Text its not working i dont know why
sorry i forgot to reply to youNp, however it's a bit of spaghetti code here, it's unnecessary to reassign
targetNotePath
to yet another Path.Combine
built string.
Try using string interpolation when concatenating strings, it helps a lot with readability, plus you don't need to call ToString
everytime.
Example:
myString = this is just a foo string, showing string interpolation foobar
The Directory
class has a GetFiles
method which also implements a simple search pattern as second parameter, besides that, you can recursively delete a folder by setting the recursive option to true
; second parameter of Directory.Delete
method.
So, what is the exception? in ex.Message
its just gives me which thing is missing or wrong and i took only that messagebox codes from chatgpt
i fully redesigned code, now code getting datas from datagridview its done