views:

196

answers:

4

I need to change the modify date on a file in windows so that it doesn't clutter up my sort order. How can I do that with a script (I may need to do that to the file in the future as well)?

thanks.

BTW: I don't want to have to install apps to do this.

A: 

Dup? See:

dirkgently
well, I wouldn't say it's a dup though it may do what I want. It would, however, just make me sick to have to install stuff just to change the dates on a file.
Keng
BTW: how's your cat?
Keng
It is the only way to do what you want from the command line. If you want to write your own code to do it you should change your question to express that desire.
EBGreen
@Keng: Improbably fine.
dirkgently
+1  A: 

Using jave you can do:

File file = new File("someFile");
file.setLastModified(long time);
Ido
+2  A: 

Here is a VBScript example of changing the mod date:

Sub ChangeModifiedDate(strFolder, strFile, dteNew)

    Dim oShell
    Dim objFolder

    Set oShell = CreateObject("Shell.Application")
    Set oFolder = oShell.NameSpace(strFolder)
    oFolder.Items.Item(strFile).ModifyDate = dteNew
End Sub
EBGreen
hmmmm....doesn't seem to work...would I need special permissions in XP for this?
Keng
+3  A: 

If you have powershell

$(Get-Item ).creationtime=$(Get-Date "mm/dd/yyyy hh:mm am/pm")
$(Get-Item ).lastaccesstime=$(Get-Date "mm/dd/yyyy hh:mm am/pm")
$(Get-Item ).lastwritetime=$(Get-Date "mm/dd/yyyy hh:mm am/pm")
Learning
Most likely that would involve installing something for him, but good answer none the less. +1
EBGreen