文件创建顺序帮助 [英] File Creation Order Help

查看:51
本文介绍了文件创建顺序帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我碰到了砖墙,可能需要集思广益.

我已经构建并运行了一个程序来处理文本文件.我们使用的Courier在输入正确"时非常挑剔...电话号码等中没有空格,因此我有一个程序位于我们的主系统和Courier系统之间.

主软件->我的程序-> Courier软件

因此,问题是:

在打印订单时,主软件为每个订单打印一个文件.它非常快速地通过这些文件,并每秒创建几个文件,文件名如下:

output8700846286136136599620.txt
output1286108217536840369.txt

文件的末尾编号没有模式来告诉它们以什么顺序出现,并且它们都以(例如)15:00:00出现,我无法按它们的创建日期排列它们都差不多吗?

快递软件在处理所有这些文件时,会按订单号(在文件内部)对它们进行排序,然后打印.

我需要尝试找到一种以创建顺序来获取文件名列表的方法.这样一来,我只需每秒发送一次,它将以正确的顺序打印.

Hi Guys.

I''ve run into a brick wall and could use some brainstorming.

I''ve got a program built and running that processes text files. The Courier we use is very fussy on inputs being "correct"... no spaces in phone numbers etc and so I have a program that sits between our main system and the courier system.

Main Software-->My Program-->Courier Software

The issues is thus:

The main software, when printing orders, prints one file for each order. It goes through these very fast, and creates several files per second with file names such as:

output8700846286136599620.txt
output1286108217536840369.txt

There is no pattern to the ending numbers of the file to tell what order they have come out in, and as they all come out at (for example) 15:00:00 I can''t arrange these by creation date as they are all about the same?

The courier software, when it processes all these files, sorts them by the order number (inside the file) then prints.

I need to try and find a way to get a list of file names in the order they are created. That way I can simply send 1 over every second and it''ll print in the correct order.

Anyone have any bright ideas?

推荐答案

您能不能使用fileinfo方法并查看createddate吗?还是可以在创建文件时触发的事件中设置文件系统监视程序和引擎盖?这样,您应该能够通过使用文件创建的日期来识别顺序....感兴趣的是结束号而不是时间在滴答声中吗?嗯,我猜不是! :)
could you not use the fileinfo method and look at the createddate? Or you could setup a filesystem watcher and hood into the events that get fired when a file is created? That way you should be able to identify the order by using the file created date.... out of interest is the end numbers not time in ticks? umm I guess not! :)


Dim objFileInfo As New FileInfo("C:\minw.txt")
'Get the creation time in year/month/day/hour/minute/second/millisecond as string and make sure it's formatted correctly.
Dim CreationDate As String = objFileInfo.CreationTime.Year.ToString & objFileInfo.CreationTime.Month.ToString("00") & objFileInfo.CreationTime.Day.ToString("00") & objFileInfo.CreationTime.Hour.ToString("00") & objFileInfo.CreationTime.Minute.ToString("00") & objFileInfo.CreationTime.Second.ToString("00") & objFileInfo.CreationTime.Millisecond.ToString("000")
MsgBox(CreationDate)



我写了以下内容.它将创建日期格式化为字符串最高"->最低".我应该可以按此排序.单独的CreationDate只是给我日期/时间没有毫秒.这行得通! :D



I wrote the following. It formats the creation date into a string highest->Lowest. I should be able to sort by this. CreationDate alone just gave me date/time no milliseconds. This works! :D


这篇关于文件创建顺序帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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