![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How to get teh recentest created file in a folder How can get a latest or oldest created file in folder with VBscript? Is there a method to do this task? -- Enjoy today |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How to get teh recentest created file in a folder Joshwa wrote: Quote: > How can get a latest or oldest created file in folder with VBscript? Is Quote: > a method to do this task? meaning the newest. In the body of the message you say "latest or oldest" which means the opposite. Which is it? -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How to get teh recentest created file in a folder "Todd Vargo" <tlvargo@xxxxxx> wrote in message news:O7kTk0RzJHA.1388@xxxxxx Quote: > Joshwa wrote: Quote: >> How can get a latest or oldest created file in folder with VBscript? Is Quote: >> a method to do this task? > Sorry, I don't understand the task. Your subject line says "recentest" > meaning the newest. In the body of the message you say "latest or oldest" > which means the opposite. Which is it? track of which is the oldest or newest according to its created date. /Al |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How to get teh recentest created file in a folder Todd, Sorry to confusing you. I did mean either the newest or oldest created file in a folder like Al mentioned In SQL Server I can use Max or Min to get the newest or oldest file in a table after I put list of files in a folder into the table. But I don't know if there is similar methods in VBScript. -- Enjoy today "Al Dunbar" wrote: Quote: > > "Todd Vargo" <tlvargo@xxxxxx> wrote in message > news:O7kTk0RzJHA.1388@xxxxxx Quote: > > Joshwa wrote: Quote: > >> How can get a latest or oldest created file in folder with VBscript? Is Quote: > >> a method to do this task? > > Sorry, I don't understand the task. Your subject line says "recentest" > > meaning the newest. In the body of the message you say "latest or oldest" > > which means the opposite. Which is it? > In either case, I would process the collection of contained files, keeping > track of which is the oldest or newest according to its created date. > > /Al > > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: How to get teh recentest created file in a folder "Joshwa" <Joshwa@xxxxxx> wrote in message news:2F9E75E8-1AE6-4A53-9E6A-0729C571A351@xxxxxx Quote: > Todd, > Sorry to confusing you. > I did mean either the newest or oldest created file in a folder like Al > mentioned > In SQL Server I can use Max or Min to get the newest or oldest file in a > table after I put list of files in a folder into the table. > But I don't know if there is similar methods in VBScript. use vbscript, SQL server, or powershell, it is not just a matter of min/max, but of extracting the name and creation date of the files in a folder, and then storing them in some structure. The simple, straightforward, vbscript approach would be to process the file collection in a loop as I said below; here is a pseudocode (i.e. some details missing) start: oldfile = "" newfile = "" oldcre = <today> newcre = <100 years ago> for each file in the folder object name = get the filename cre = get the file's creation date if ( cre < oldcre ) then oldfile = name oldcre = cre elseif ( cre > newcre ) then newfile = name newcre = cre end if next A more SQL-like solution could make use of ADO queries, however, I do not know if there is an ADO interface to the file system. If there were it could work directly, otherwise, you would have to use a for each loop to extract the file names and creation dates into some format against which an ADO query could be targetted. IMHO that would make more sense if there were other database-style operations you might want to perform. Otherwise the straightforward approach may be the simplest. /Al Quote: > -- > Enjoy today > > > "Al Dunbar" wrote: > Quote: >> >> "Todd Vargo" <tlvargo@xxxxxx> wrote in message >> news:O7kTk0RzJHA.1388@xxxxxx Quote: >> > Joshwa wrote: >> >> How can get a latest or oldest created file in folder with VBscript? >> >> Is >> > there >> >> a method to do this task? >> > >> > Sorry, I don't understand the task. Your subject line says "recentest" >> > meaning the newest. In the body of the message you say "latest or >> > oldest" >> > which means the opposite. Which is it? >> In either case, I would process the collection of contained files, >> keeping >> track of which is the oldest or newest according to its created date. >> >> /Al >> >> >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Grabbing a string that's already been created in one .vbs file and doing stuff with it in a second .vbs file | VB Script | |||
| RE: The folder could not be created." | Vista mail | |||
| the folder cannot be created | Vista mail | |||
| Can't modify a folder I created myself | Vista file management | |||
| Can't open folder I created in XP | Vista security | |||