Create folder in another folder | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Create folder in another folder

Hi i want create app that create folder from file name and the move file to folder that has same name I use IEnumerable to search file with mkv extension and the use foreach to move every file to their folder but my code can't create folder ( sorry for my bad English ) use Directory.CreateDirectory (path.getfilenamewithoutextension(iso //iso came from foreach for separate file ))

26th Apr 2019, 7:12 PM
Saman Saman
Saman Saman - avatar
1 Answer
+ 1
Can you create a directory in that folder using explorer ? Do you have writing or modifying rigths ? What is the value of path.getfilenamewithoutextension Can you print this ? // GetFileNameWithoutExtension('C:\mydir\myfile.ext') returns 'myfile' It could be that you need to add the root-path (Like "c:\temp" or something more usefull) to the result of "getfilenamewithoutextension" https://docs.microsoft.com/en-us/dotnet/api/system.io.path.getfilenamewithoutextension?view=netframework-4.8
27th Apr 2019, 8:43 PM
sneeze
sneeze - avatar