topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 6:41 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: [IDEA] easily change last modified date to current date  (Read 7917 times)

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
=======================================
[IDEA] easily change last modified date to current date
=======================================

I want to be easily change the last modified date of a file to the current date/time * - without having to open it and resave it, i.e. I'm looking for a quicker way of doing this

on searching I see Online Tech Tips recommends a few programmes. Then this page tells me how to do it using a (paid) programme which allows me to do it via file > properties/date/etc.
All are a bit time consuming - it would probably be as easy for me to open and resave the file (the programmes from the fist link would be especially suitable if I wanted to batch change files - but I dont)

Implementation ideas:
  • via context menu
  • or AHK: with hotkey that would work on file currently selected in file manager (I use DOpus or XYplorer but if I had to I'd use Win. Exp.)

Use:
basically I'm working on files in sequence. These files are sorted by last modified date - so if I want to move a file up the list, the only way is to change the last mod.date (I cant mess with the filenames)


* I'd be very happy with simply changing to current date time - if I want to change it to another date/time I can use 'SetFileDate' programme which I got from the link above: but if some dc whiz programmer can do this too I wont complain ;)
Tom

fenixproductions

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,186
    • View Profile
    • Donate to Member
Re: [IDEA] easily change last modified date to current date
« Reply #1 on: May 21, 2009, 09:19 AM »
2tomos
Maybe add 'SetFileDate' to Windows "Send to" menu?

Personally I would use Total commander for that but DO or XYplorer should have it too!

Edited…

Single file AHK:
if 0 < 1
{
MsgBox, You must specify file name!
}
else
{
FileSetTime, , %1%, M
}
« Last Edit: May 21, 2009, 09:33 AM by fenixproductions »

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: [IDEA] easily change last modified date to current date
« Reply #2 on: May 21, 2009, 04:32 PM »
thanks fenix

as I say - if I have to 'send' the file to any programme, it works out quicker to actually open file in default programme and resave it.

thanks for the AHK script but same problem there I think - when I try to open it it says I have to specify filename - that means in the script I presume? or was it intended to be used another way?

It's quite possible DOpus can do this, I should check their forums ...
Tom

fenixproductions

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,186
    • View Profile
    • Donate to Member
Re: [IDEA] easily change last modified date to current date
« Reply #3 on: May 21, 2009, 05:27 PM »
2tomos

as I say - if I have to 'send' the file to any programme, it works out quicker to actually open file in default programme and resave it.
-tomos

It's not always true. The only thing this script (compiled to exe) does is changing modified date. That is all. Default applications need to read whole file content and in most of the cases they will be slower because of that.

thanks for the AHK script but same problem there I think - when I try to open it it says I have to specify filename - that means in the script I presume? or was it intended to be used another way?
-tomos

It is meant to be started with filename as parameter. If there is no parameter -> message is shown.

The best for you would be to compile it to EXE and to follow this article:
http://lifehacker.co...d-to-menu-136345.php

It should solve "missing file" problem.

P.S. I don't know DO but in TC you can create button with this application and drop needed file on it. Perhaps it's possible in DO too (or start application with selected file name as parameter).
« Last Edit: May 21, 2009, 05:29 PM by fenixproductions »

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: [IDEA] easily change last modified date to current date
« Reply #4 on: May 21, 2009, 05:42 PM »
well I converted it to exe (first time doing that), made a new 'button' in Dopus with the function:
"insert exe path here" {filepath}

and . . hey presto - it works a treat :Thmbsup: just got to click the button while the file is selected :)
Tom

fenixproductions

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,186
    • View Profile
    • Donate to Member
Re: [IDEA] easily change last modified date to current date
« Reply #5 on: May 21, 2009, 06:09 PM »
2tomos

Does DO have a function to save selected files to list*? If yes, what is the format of such file?

I could try to write second version with multiple files handling. It shouldn't be hard :)

*) In TC you just select files and pass %L parameter (which is replaced by i.e. c:\tmp\list.txt file) to proper application.

Edited

If your files selection is stored in list file where each name is in separate line, similar to:
D:\code\AutoHotkey\Compiler\Ahk2Exe.exe
D:\code\AutoHotkey\Compiler\README.txt

Then AHK code for v.2. is:
if 0 < 1
{
MsgBox, You must specify list file name!
}
else
{
Loop
{
FileReadLine, line, %1%, %A_Index%

if ErrorLevel
break

FileSetTime, , %line%, M
}
}

Of course, you need to start second version with list name as parameter.

I did not check but it should also work with folders.
« Last Edit: May 21, 2009, 06:23 PM by fenixproductions »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: [IDEA] easily change last modified date to current date
« Reply #6 on: May 21, 2009, 06:25 PM »
There used to be freeware utilities named "touch.exe" that did that one function. Command line would probably be the most efficient.  All the files on the command line get touched.  Then you can run it in batch files or just drag & drop a bunch of files on it.

Just searching "Touch" on softpedia.com comes up with a bunch

« Last Edit: May 21, 2009, 06:28 PM by MilesAhead »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: [IDEA] easily change last modified date to current date
« Reply #7 on: May 21, 2009, 08:45 PM »
tomos: you can use FileMenu Tools to do what you want. i myself use 12Ghosts for this purpose but it's shareware.