返回错误的目录名称 [英] Wrong directory name is returned

查看:73
本文介绍了返回错误的目录名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我为工作而写的Windows应用程序。 我们建造工业设备,每个都有一个唯一的序列号。 创建占位符文件名,然后当我们接近发货时,文件名将更改为反映最终的序列
编号。 例如,17X20002456将变为17N20002456,X将替换为月份代码的N. 我一直在使用Directory.GetDirectories(),整行是:

I have a windows application I've written for work.  We build industrial equipment, each one has a unique serial number.  A placeholder filename is created, then when we are close to shipping it the file name is changed to reflect the final serial number.  For example, 17X20002456 would become 17N20002456, the X being replaced by the N for the month code.  I've been using Directory.GetDirectories() for this, the whole line being:

string [] m = Directory.GetFiles (loc," *" + s +" *",SearchOption.AllDirectories);

" loc"用作搜索的起点和"s"。是我正在搜索的序列号。

"loc" is used as the starting point for the search and "s" is the serial number I'm searching for.

然后我会显示返回的内容,以便您可以选择所需的序列号。 我看到的问题是,在文件名更新后,我仍然获得17X值,而不是更新的17N值。 任何jhelp将不胜感激!

I then display whats returned so you can select the one you want.  The issue I'm seeing is that after the file name is updated I'm still getting the 17X value rather then the updated 17N value.  Any jhelp would be greatly appreciated!

推荐答案

目前还不是很清楚你要求的是什么。我的理解是,将文件从"17X20002456"重命名为"17N20002456"失败,并且您的文件仍保留其原始名称。这是问题吗?那么你的代码是什么重命名这些文件。 

It's not quite clear what you are asking for. My understanding is that the renaming of your files from '17X20002456' to '17N20002456' failed and your files have still kept their original names. Is that the issue? Then what's your code to rename those files. 

wizend





这篇关于返回错误的目录名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆