If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Changeing Date/Time properties of Directories

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-10, 03:04
Wim Venema Wim Venema is offline
Registered User
 
Join Date: Jun 2004
Location: Lichtenvoorde, Netherlands
Posts: 53
Changeing Date/Time properties of Directories

Hi,

I'm looking for a script to change the date/time properties of (a list of)directories with the date of the oldest (or newest) file in these directories.
Can anyone help?

Regards,

Wim Venema
Reply With Quote
  #2 (permalink)  
Old 02-01-10, 11:48
Ax238 Ax238 is offline
Registered User
 
Join Date: May 2009
Posts: 257
You can write a script around the touch command line tool:
Touch.exe: Set the timestamp of files to the current time on Windows systems

The easiest way to do this would be to incorporate it into a batch script, using for, dir (ordered), date and time (to set date/time before calling touch), and finally touch the directory with the first result from the ordered dir output.

Alternatively, you can use the Windows API/.NET command:
SetFileTime
Setting a folder's date and time. - CodeGuru Forums

Ax
Reply With Quote
  #3 (permalink)  
Old 02-01-10, 12:34
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
I suppose you could shell out to good old dos, run a DIR command, ordered by /D date and then send the output to a file and read that file in VB......

mind you, you could probably do that these days using vbs, instead of using 1980's/90's style dos commands
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On