How to change modified date of .dbf file?

August 12, 2010 at 18:12:46
Specs: Windows XP
How can I change the modified date of a .DBF file?

In a daily run batch file, I want to take the same file that was created long time ago and then change its modified date to the current date so it won't display warning on the screen when processed in another program.

By copying, the creation date changes but not the modified date. The other program (fox something) seems to be eyeing only the modified date.

Thanks for the help.


See More: How to change modified date of .dbf file?

Report •


#1
August 12, 2010 at 19:25:47
Copy filename.dbf,,+

Report •

#2
August 13, 2010 at 03:23:21
copy myfile,,+


=====================================
Helping others achieve escape felicity

M2


Report •

#3
August 13, 2010 at 08:31:55
Hi Wahine,

Sorry, overlooked yours. [DOH]


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
August 13, 2010 at 11:24:39
Actually, I already saw that ",,+" in another question on txt file but somehow when I typed it myself it didn't work. So I thought it only works for txt files.

Now that I copy&pasted your reply, it worked! Is there a magic trick somewhere? :D

Thanks!

How about if I want to date it as of yesterday?

Or, if it is not too much to ask, I want to date it as of the previous working day so that if today is monday, the file date will change to last friday.


Report •

#5
August 13, 2010 at 11:48:03
Not obvious why it works pasted but not typed.


=====================================
Helping others achieve escape felicity

M2


Report •

#6
August 13, 2010 at 20:43:33
Quote=JMR: How about if I want to date it as of yesterday?

Or, if it is not too much to ask, I want to date it as of the previous working day so that if today is monday, the file date will change to last friday.

I hope you're not gonna come up with any more surprises LOL.

The following batch script/VB script should do what you want but it does NOT cater for national or local holidays where if Friday is a hol it doesn't change the date to the previous working day and if Monday is a holiday, when the script is run on Tuesday the filedate will be changed to Monday. You must change the indicated line to reflect your filename. Not fully tested.

@echo off
cls
setlocal enabledelayedexpansion

set vbs=%temp%\vbs.vbs
> %vbs% echo WScript.Echo Date
for /f "tokens=*" %%a in ('cscript //nologo %vbs%') do set savdate=%%a

(
echo Newdate = Date
echo   Wn = DatePart("W"   , Newdate^)
echo Wscript.Echo Wn
)>%vbs%

FOR /F "tokens=1" %%A in ('cscript //nologo %vbs%') do (
        set Weekday#=%%A
	)

If !weekday#! equ 1 set backdate=2&goto cont
if !weekday#! equ 2 set backdate=3&goto cont
set backdate=1

:cont
> %vbs% echo WScript.Echo DateAdd("d",-%backdate%,Date)
for /f "tokens=* delims=" %%a in ('cscript //nologo %vbs%') do set newdate=%%a

del %vbs%

:: Set filename to reflect YOURS
:: =============================

:: Alter system date and file amended date
echo %newdate% echo.|date> nul

set filename=trial.bat

copy %filename%,,+> nul

:: Restore system date
echo %savdate% echo.|date> nul

dir %filename%

Warning: During the few microseconds the date is changed to Newdate any file created/updated/accessed may show the date(s) as the Newdate. Also any program which uses the date (e.g. to name backups) could use the Newdate instead of the current date. Please check this out when testing the script.

Wish you good luck

Edited to add warning and post updated script after some testing.


Report •

#7
August 15, 2010 at 19:43:25
Thanks.

But I don't exactly know where to put the file name in the script. I tried a few times and all I get is "no file found".

So here's the file and it's location. How does it fit in the script you generously wrote?

K:\Big Folder\small folder\file folder\datalocation\testing.dbf

Thanks.


Report •

#8
August 16, 2010 at 02:46:29
OK, Try this:

:: Alter system date and file amended date

pushd k:\big folder\small folder\file folder\datalocation\

set filename=testing.dbf

echo %newdate% echo.|date> nul

copy %filename%,,+> nul

:: Restore system date
echo %savdate% echo.|date> nul

dir %filename%
popd


Report •

#9
August 16, 2010 at 20:31:44
^ this one gave a result just like the ",,+" and not dated as today-minus-one.

would it be easier, or is it possible, to "copy" the date modified of another file and apply that to the file I need?


p.s. thanks for your kindness


Report •

#10
August 17, 2010 at 00:40:29
this one gave a result just like the ",,+" and not dated as today-minus-one.

Then something failed without you noticing it. Should there be a space in datalocation?

Please post the script you are using.


Report •

#11
September 9, 2010 at 23:29:52
Thanks for your help.

I have decided to redate the file on the same day. I just have to do it at the end of the day. I think this is much better than waiting for the next day to redate it, especially because it will become more complicated when weekend and holidays come in between.


Report •


Ask Question