Change File Date/Time?

How can I change the Date and Time of file, the one that says created on xxxxx.
I am using windows XP and DOS
LVL 1
Jess31Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kamaraj SubramanianApplication Support AnalystCommented:
Change a File's Date and Time Stamp to current (Win98):

copy thefilename.txt /B+ ,,/Y
and if you need to do a bulk change to a whole directory of gif files:

for %i in ('dir *.gif') do copy %i /B+ ,,/Y
which all change the Date/Time stamp of all the files with the extension GIF in the current directory.

http://www.sprint.net.au/~terbut/usefulbox/msdoscmds.htm

http://www.robvanderwoude.com/datetime.php
Jess31Author Commented:
The command you give me is if I want to change it to the Current date/time. That is not what I want to do. I want be able to change it to a Date and Time of the past.
Kamaraj SubramanianApplication Support AnalystCommented:
you can use the filetouch utility to change the date/time of the file

http://www.softtreetech.com/24x7/archive/47.htm
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

ReneGeCommented:
Following itkamaraj's filetouch utility here's your batch file.

Cheers
 
@ECHO OFF
SET BaseFolder=C:\FileToChangeDates
REM CreatedDate=MM-DD-YYYY
SET CreatedDate=02-01-2006
SET CreatedTime=22:01:02
FOR /R "%BaseFolder%" %%A in (*.*) DO FileTouch.exe /C /D %CreatedDate% /T %CreatedTime% "%%~fA"
EXIT

Open in new window

OR
 
@ECHO OFF
SET BaseFolder=C:\FileToChangeDates
REM CreatedDate=MM-DD-YYYY
SET CreatedDate=02-01-2006
SET CreatedTime=22:01:02
FileTouch.exe /C /D %CreatedDate% /T %CreatedTime% "%BaseFolder%\*.*"
PAUSE
EXIT

Open in new window

ReneGeCommented:
And to change the sub-folders date and time, add "/S".

Note that the following will also change the subfolder files date and time.

Cheers
@ECHO OFF
SET BaseFolder=C:\FileToChangeDates
REM CreatedDate=MM-DD-YYYY
SET CreatedDate=02-01-2006
SET CreatedTime=22:01:02
FOR /R "%BaseFolder%" %%A in (*.*) DO FileTouch.exe /C /S /D %CreatedDate% /T %CreatedTime% "%%~fA"
EXIT

Open in new window

fadli_ezzatiCommented:
How about changing your computer's to desired date & time. Then copy the file/s to other location. Then u will have same file with the creation date you want. Rename and replace.
sjklein42Commented:
How about changing your computer's to desired date & time. Then copy the file/s to other location. Then u will have same file with the creation date you want. Rename and replace.

Somewhat frightening suggestion, considering how many operating system files, etc, are also modified while the computer is running, not to mention how it will confuse or disable auto-updates (like Windows Update) that may decide to run while the clock is set wrong.
ReneGeCommented:
I agree with sjklein42
Bill PrewIT / Software Engineering ConsultantCommented:
If you are okay with a GUI tool, check out this:

http://www.nirsoft.net/utils/filedatech.html

~bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill PrewIT / Software Engineering ConsultantCommented:
If you want a command line utility, here's one of those:

http://www.softtreetech.com/24x7/archive/47.htm

~bp
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.