473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

File Structure

Hi
I'm looking for a way to extract a file name and file create date and then
replace them after modifying them.
I'd be grateful for any help.
Peter
To err is human but it takes a computer to really mess things up!
Jul 17 '05 #1
8 6042
Use the FileSystemObject to gain access to files and their properties.

Dim objFSO As New FileSystemObject
Dim objFolder As Folder
Dim objFile As File
Set objFolder = objFSO.GetFolder(sFilePath)
For Each objFile In objFolder.Files
sFileName = objFile.Name
dCreateDate = objFile.DateCreated
dModifiedDate = objFile.ModifiedDate
Next

NOTE: The file dates are read-only properties.
"Peter" <ga*****@SPAMblueyonder.co.uk> wrote in message
news:w4**************@fe3.news.blueyonder.co.uk...
Hi
I'm looking for a way to extract a file name and file create date and then
replace them after modifying them.
I'd be grateful for any help.
Peter
To err is human but it takes a computer to really mess things up!

Jul 17 '05 #2
Many thanks, I'll start playing when I get a minute.
Pity about the dates - is there any way to modify these?

Peter
To err is human but it takes a computer to really mess things up!

"James L Hill" <ja**********@verizon.net> wrote in message
news:gkCMd.6364$Dc.5137@trnddc06...
Use the FileSystemObject to gain access to files and their properties.

Dim objFSO As New FileSystemObject
Dim objFolder As Folder
Dim objFile As File
Set objFolder = objFSO.GetFolder(sFilePath)
For Each objFile In objFolder.Files
sFileName = objFile.Name
dCreateDate = objFile.DateCreated
dModifiedDate = objFile.ModifiedDate
Next

NOTE: The file dates are read-only properties.
"Peter" <ga*****@SPAMblueyonder.co.uk> wrote in message
news:w4**************@fe3.news.blueyonder.co.uk...
Hi
I'm looking for a way to extract a file name and file create date and
then
replace them after modifying them.
I'd be grateful for any help.
Peter
To err is human but it takes a computer to really mess things up!


Jul 17 '05 #3
> Pity about the dates - is there any way to modify these?

http://vbnet.mvps.org/code/fileapi/filedatetime.htm

Rick - MVP
Jul 17 '05 #4
Many thanks (I think!).
As a dabbler in Vb (but not in programming, I wrote my first program back in
1968 in a nice air conditioned room!)
I can see I'm going to have some fun.

Peter

"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message
news:Xo********************@comcast.com...
Pity about the dates - is there any way to modify these?


http://vbnet.mvps.org/code/fileapi/filedatetime.htm

Rick - MVP

Jul 17 '05 #5
> Many thanks (I think!).
As a dabbler in Vb (but not in programming, I wrote my first program back in 1968 in a nice air conditioned room!)
I can see I'm going to have some fun.


Sorry for the ugliness of the API solution I referred you to; however,
as James pointed out, VB does not have direct write access to the dates,
so the only solution is to use API functions.

Rick - MVP

Jul 17 '05 #6
No problem. It will force me to get to grips with API.
Another question has occurred to me now. I can see how to display a list of
folders and select one. Can I access the contents so that I can get all the
file names in an array?

Sorry about all the individual questions

Peter

"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message
news:8_********************@comcast.com...
Many thanks (I think!).
As a dabbler in Vb (but not in programming, I wrote my first program

back in
1968 in a nice air conditioned room!)
I can see I'm going to have some fun.


Sorry for the ugliness of the API solution I referred you to; however,
as James pointed out, VB does not have direct write access to the dates,
so the only solution is to use API functions.

Rick - MVP

Jul 17 '05 #7

Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolder = "C:\Temp"

Set objFolder = objFSO.GetFolder(strFolder)
Set objFiles = objFolder.Files

For Each objFile in objFiles
MsgBox objFile.Name
Next
Peter wrote:
No problem. It will force me to get to grips with API.
Another question has occurred to me now. I can see how to display a list of
folders and select one. Can I access the contents so that I can get all the
file names in an array?

Sorry about all the individual questions

Peter

"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message
news:8_********************@comcast.com...
Many thanks (I think!).
As a dabbler in Vb (but not in programming, I wrote my first program


back in
1968 in a nice air conditioned room!)
I can see I'm going to have some fun.


Sorry for the ugliness of the API solution I referred you to; however,
as James pointed out, VB does not have direct write access to the dates,
so the only solution is to use API functions.

Rick - MVP


Jul 17 '05 #8
Thanks

Peter

"Spanner" <no******@no.email.com> wrote in message
news:hz********************@news-server.bigpond.net.au...

Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolder = "C:\Temp"

Set objFolder = objFSO.GetFolder(strFolder)
Set objFiles = objFolder.Files

For Each objFile in objFiles
MsgBox objFile.Name
Next
Peter wrote:
No problem. It will force me to get to grips with API.
Another question has occurred to me now. I can see how to display a list
of folders and select one. Can I access the contents so that I can get
all the file names in an array?

Sorry about all the individual questions

Peter

"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message
news:8_********************@comcast.com...
Many thanks (I think!).
As a dabbler in Vb (but not in programming, I wrote my first program

back in

1968 in a nice air conditioned room!)
I can see I'm going to have some fun.

Sorry for the ugliness of the API solution I referred you to; however,
as James pointed out, VB does not have direct write access to the dates,
so the only solution is to use API functions.

Rick - MVP



Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vasilis Serghi | last post by:
Hi all, I am fairly new to C programming and I have come to a stand still. I am trying to create a program that will accept a user input and give the user an output depending on the contents of a...
5
by: Chathu | last post by:
Hello everyone........... I have a problem on retriving a content of a binary file I wrote into. My program user structures, dynamic allocation of memory and files. I take the infomation into a...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
3
by: Zahid | last post by:
Hi, I have declared an array holding a custom declared structure. The structure looks like this: Private Structure MnuDataFrmFile Public menuGroup As String Public ItemDesc As String Public...
5
by: Phil Kelly | last post by:
Hi I need to write the contents of a structure to a binary file - there is one string and 2 integers, but I can't seem to figure out how to write the data correctly. If I am simply writing...
8
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
9
by: JimmyKoolPantz | last post by:
IDE: Visual Studio 2005 Language: VB.NET Fox Pro Driver Version: 9.0.0.3504 Problem: I currently have a problem altering a DBF file. I do not get any syntax errors when running the program. ...
19
by: Lee Crabtree | last post by:
Is there a class in the framework that allows me read text from a file in an unbuffered manner? That is, I'd like to be able to read lines in the same manner as StreamReader.ReadLine(), but I also...
4
by: MikeJ | last post by:
make a While loop ofs = TextFileServer("somefile") string srow while (ofs=false) { srow=ofs.getRow(); Console.Writeline(srow); }
6
by: efrenba | last post by:
Hi, I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.