简体   繁体   中英

GetDirectories returns path\\dir

I am using string[] dirs = Directory.GetDirectories("instances", "*") to get all the directories.

But it returns the directories as followed:

instances\\\\test01, instances\\\\test02

Then i use the following function to download a file to that directory:

FileDownloader downloader = new FileDownloader(dirs[0] + "/server/server.jar", "blabla");

But the file appear in the root directory instead.
Any suggestions?

Instead of dirs[0] + "/server/server.jar"

use

Path.Combine(dirs[0], "/server/server.jar")

I'd imagine that the string appending could be treating \\t as a tab

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM