获取一个或多个文件的文件路径 [英] get file path(s) for one or more files
问题描述
嘿!
我有一个问题可能已经得到解答但是这里有。
我想要完成的是从一个应该包含单个文件的文件夹中获取完整文件路径的列表。
文件名是常量,除了它附加日期。所以基本上文件名各不相同,但总是相同的扩展名(例如.csv)。
我要做的是使用这个文件列表来附加文件或文件到电子邮件。
我已经建立了这个程序,以便程序查找名为今日日期的文件夹。效果很好。如果创建了文件夹,则会发送电子邮件。
所以我想通过电子邮件发送该文件夹中的文件作为发送电子邮件的附件。
我还是很新,所以答案越简单越好!
提前致谢!
Nick
Hey!
I have a question that maybe has been answered but here goes.
What I am trying to accomplish is getting a list of full file path(s) from a folder that should contain a single file.
The file name is constant except it is appended with a date. So basically the file name varies but always the same extension (example ".csv").
What I am going to do is use this file list to attach the file or files to a email.
I have built this up to the point that the program looks for a folder created named "todays date". Works great. If the folder is created a email is sent.
So I'd like to email the file(s) in that folder as an attachment to the email sent.
I'm still really new at this, so the simpler the answer the better!
Thanks in advance!
Nick
推荐答案
使用 Directory.EnumerateFiles [ ^ ]检索目录中的文件列表。
使用 Directory.EnumerateDirectories [ ^ ]检索目录中的目录列表。
Use Directory.EnumerateFiles[^] to retrieve a list of the files in a directory.
Use Directory.EnumerateDirectories[^] to retrieve a list of the directories within a directory.
这篇关于获取一个或多个文件的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!