帮我找到文件夹和文件 [英] help me find folder and file

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

问题描述

以我为例的项目

在hardisk中按版本名称查找文件夹
如果以版本名称命名的文件夹在文件夹名称版本中找到了chek文件. txt
如果里面有文件夹版本,则有文件版本. txt重命名版本. txt,由versionold命名. txt
如果文件夹中有文件夹版本,则存在文件versionolder.txt调用创建"(创建文件版本为txt)
如果是文件夹版本和文件版本. txt和versionold. txt找到完成
如果是文件夹版本和文件版本. txt和versionold.找不到txt完成
结束子


硬键(c:d:e:等)

文件夹名称版本

文件版本. txt

文件verionold. txt

调用创建"出来创建文件名"version.txt"

私人create()

打印修订版
打印修订版

end sub

example me project

find folder by the name of version in hardisk
if folder by the name of version found chek file insides folder name version. txt
if folder version insides he is there file version. txt rename version. txt by the name of versionold. txt
if folder version insides he is there file versionolder.txt "call create" (out create file name version. txt)
if folder version and file version. txt and versionold. txt found finish
if folder version and file version. txt and versionold. txt not found finish
end sub


hardisk (c: d: e: etc)

folder name version

file version. txt

file verionold. txt

" call create" out create file name "version.txt"

private create()

print revision
print revision

end sub

推荐答案

我还没有经验,可以举示例详细信息

以我为例程序


私人子Form_Load()
将CheckFile1,CheckFile2变暗为字符串

''首先检查文件夹是否存在.
如果Dir("c:\ version",vbDirectory)= vbNullString然后
退出子
如果结束

''检查文件是否存在
CheckFile1 = Dir
i am not yet experienced can given example detailer

example me program


Private Sub Form_Load()
Dim CheckFile1, CheckFile2 As String

'' Check if folder exists, first.
If Dir("c:\version", vbDirectory) = vbNullString Then
Exit Sub
End If

'' Check if file exists
CheckFile1 = Dir


("c:\ version \ version.txt")
CheckFile2 = Dir
("c:\version\version.txt")
CheckFile2 = Dir


("c:\ version \ versionold.txt")
如果CheckFile1 ="version.txt"和CheckFile2 ="versionold.txt",则
退出子
ElseIf CheckFile1 ="version.txt"然后
名称"c:\ version \ version.txt"为"c:\ version \ versionold.txt"
呼叫CreateFile
如果结束


结束子




私人子CreateFile()
''======================================
''
''======================================

打开"\ version \ version.txt",将其输出为#1

打印#1,版本= 1.0"
打印#1,标签= 123"
打印#1,"


关闭#1
结束子


目标c中的该程序:
例子
c:\ version \(forder版本位置c:)
c:\ version \ version.txt
c:\ version \ versionold.txt

1.如果文件夹版本不是硬键,如何找到文件夹版本c:
示例用户为我安装程序位置d:\或e:\
2.如果找到文件夹版本,如果文件夹不是硬键,如何创建我的文件c:\

谢谢
("c:\version\versionold.txt")
If CheckFile1 = "version.txt" And CheckFile2 = "versionold.txt" Then
Exit Sub
ElseIf CheckFile1 = "version.txt" Then
Name "c:\version\version.txt" As "c:\version\versionold.txt"
Call CreateFile
End If


End Sub




Private Sub CreateFile()
'' =========================================
''
'' =========================================

Open "\version\version.txt" For Output As #1

Print #1, "Version =1.0 "
Print #1, "Label = 123"
Print #1, ""


Close #1
End Sub


this program in target c:
example
c:\version\ (forder version location c: )
c:\version \version.txt
c:\version\versionold.txt

1.how find folder version if folder version not hardisk c:
example user install me program location d:\ or e:\
2.if folder version found how create me files if folder not hardisk c:\

thanks


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

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