Change file's date and time

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
Dimmak
Junior Coder
Posts: 25
Joined: Tue Jan 24, 2012 4:57 pm

Change file's date and time

Post by Dimmak » Fri Jan 27, 2012 1:41 pm

I'm use 'CopyFile' command but copy's date&time like in original file.
How to change file's date&time :?:

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

not sure

Post by PepsiHog » Fri Jan 27, 2012 3:26 pm

Someone probably has a vbScript or a better solution.

But if the files you want to copy are small, but you want the new files to reflect the current time and date, then you could do this.


Code: Select all

ReadFile>C:\Documents and Settings\.....\Desktop\scrpts\a Create Button Group.scp,File
WriteLn>C:\Documents and Settings\.....\Desktop\a Create Button Group.scp,wtf,%File%
I say small because reading in a very large file may take some serious time. And if you don't have enough memory, may freeze or not work.

Between those two lines you could run command.com and change the date and time before writing the file. Then at the end of the script change date and time back. (you'd need to store the current date and time first, ofcourse)
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Dimmak
Junior Coder
Posts: 25
Joined: Tue Jan 24, 2012 4:57 pm

Post by Dimmak » Fri Jan 27, 2012 4:40 pm

It's some... difficult... :?
Then I just put date\time in filename.
or...
nircmd.exe >>> Windows\Sys32

Run>nircmd.exe setfiletime "C:\file.scp" "" now :wink:

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

hello

Post by PepsiHog » Sat Jan 28, 2012 1:41 am

Good program NirCmd. I've used it in the past as well.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts