Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Set folder date to newest file

Reply
 
Old 07-09-2009   #1 (permalink)
HAL07


 
 

Set folder date to newest file

I would like to traverse all subfolders of a root and set folder date as the latest file within. Modified date, that is.

--
-- HAL07, Engineering Services, Norway

My System SpecsSystem Spec
Old 07-10-2009   #2 (permalink)
Mark D. MacLachlan


 
 

Re: Set folder date to newest file

HAL07 wrote:
Quote:

> I would like to traverse all subfolders of a root and set folder date
> as the latest file within. Modified date, that is.
I don't beleive this is possible, you can modify the folder to change
the last modified date to the current date, but cannot "spoof" the date.

Regards,

Mark D. MacLachlan

--

My System SpecsSystem Spec
Old 07-10-2009   #3 (permalink)
HAL07


 
 

Re: Set folder date to newest file

Mark D. MacLachlan wrote:
Quote:

> HAL07 wrote:
>
Quote:

>> I would like to traverse all subfolders of a root and set folder date
>> as the latest file within. Modified date, that is.
>
> I don't beleive this is possible, you can modify the folder to change
> the last modified date to the current date, but cannot "spoof" the date.
>
> Regards,
>
> Mark D. MacLachlan
>
I found the following in powershell:
$folder = "c:\files"
$search = $folder + "\*.*"
$a = get-childitem $search | sort-object LastWriteTime | select-object -last 1
$b = Get-Item $folder
$b.LastWriteTime = $a.LastWriteTime

Bah. That won't help me much. Are you sure it's not possible on vbscript? Powershell is not installed on all my servers, and some
servers are beyond my control.
--
-- HAL07, Engineering Services, Norway
My System SpecsSystem Spec
Old 07-11-2009   #4 (permalink)
Mark D. MacLachlan


 
 

Re: Set folder date to newest file

HAL07 wrote:
Quote:

> Mark D. MacLachlan wrote:
Quote:

> > HAL07 wrote:
> >
Quote:

> > > I would like to traverse all subfolders of a root and set folder
> > > date as the latest file within. Modified date, that is.
> >
> > I don't beleive this is possible, you can modify the folder to
> > change the last modified date to the current date, but cannot
> > "spoof" the date.
> >
> > Regards,
> >
> > Mark D. MacLachlan
> >
> I found the following in powershell:
> $folder = "c:\files"
> $search = $folder + "\*.*"
> $a = get-childitem $search | sort-object LastWriteTime |
> select-object -last 1 $b = Get-Item $folder
> $b.LastWriteTime = $a.LastWriteTime
>
> Bah. That won't help me much. Are you sure it's not possible on
> vbscript? Powershell is not installed on all my servers, and some
> servers are beyond my control.
Have you tested that with PowerShell? I have not tested it but it
seems to me it should not work. Anyway, if it does work, you should be
able to target remote servers even if they don't have PowerShell. Just
reference the remote server via UNC.

$folder = "\\remoteserver\c$\files"

--

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How do I view file date in file open dialogs and Win Explorer Vista file management
Solved Date Taken Folder Question General Discussion
Photo date taken vs. file date Vista music pictures video
WMDC Changes File Date When copying file to Laptop Vista General
finding the newest file in a directory PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46