# Checking file date/time stamps via batch file?



## RastaPickles (Mar 17, 2013)

Hope someone can help.

We have a database that is viewable as a folder on a server......you can double click on it and see the various cubes and entities (encrypted, of course).

What I'm looking to do is to automate a script (via VBA, batch file, whatever) that will parse through the folder and check the last modified date of certain cubes. This will enable me to know whether our overnight load process has run successfully.

Can anyone help?

As an example, assume the database is called test.dtb, lives in c:\test and I want to check on the cubes named V900.cub, V901.cub, V902.cub......so the script (or whatever) will look at V900.cub, perform a check to see if today's date = the last modified date and if so, move onto V901.cub and perform the same check, and so on.

If the check fails, it will write to a log file and then move onto V901.cub and perform the same check, and so on.

Any advice gratefully received....I did ask this on another website forum but the thread was closed as "not a real question" ??!!


----------



## foxidrive (Oct 20, 2012)

RastaPickles said:


> As an example, assume the database is called test.dtb, lives in c:\test and I want to check on the cubes named V900.cub, V901.cub, V902.cub......so the script (or whatever) will look at V900.cub, perform a check to see if today's date = the last modified date and if so, move onto V901.cub and perform the same check, and so on.


Are the files v901.cub and other *.cub files all lumped in the c:\test folder along with test.dtb ?

I suspect your filenames and information aren't quite accurate and is why your other post was deemed the way it was. A lot of the time it matters, in batch files. People often make up scenarios which they think is representative, get a solution which doesn't work in their situation, because they gave inaccurate information.


----------



## RastaPickles (Mar 17, 2013)

Yes, c:\test is the master directory.

Within there lives the database itself (test.dtb)......but this database appears as a folder (you can double click on it and see v901.cub, v902.cub etc).

So I need a batch file that will effectively open c:\test\test.dtb and parse through the .cub files and write to a log any that don't have today's date.

I can probably do this quite easily in Excel VBA but I'd prefer a batch file solution.

Thank you for reading.


----------



## foxidrive (Oct 20, 2012)

Ok... It would seem that's using a program function to open the .dtb file and batch doesn't have access to it AFAIK.


----------



## Squashman (Apr 4, 2003)

Test.dtb is either a folder or a database file. It can't be both. If it is a database file, a batch file will not be able to open it and read the contents of the database.


----------



## RastaPickles (Mar 17, 2013)

Squashman said:


> Test.dtb is either a folder or a database file. It can't be both. If it is a database file, a batch file will not be able to open it and read the contents of the database.


These are not your standard database files; trust me, test.dtb appears as a standard folder and you can simply double click on it and view the cubes/entities etc together with timestamps.

Ok, let's forget test.dtb.

Is there a way via a batch file to open the folder c:\test and parse through all files in that folder and create a logfile of any that do not have today's date as last modified?

Thank you and I apologise if this is all a little confusing.


----------



## foxidrive (Oct 20, 2012)

Agreed. It's like using a .tib file with Acronis. It's registered to an acronis program to open it where it looks like an explorer window. 

Not browse-able from the command line.

I suspect the .dtb file is similar.


----------



## foxidrive (Oct 20, 2012)

RastaPickles said:


> Is there a way via a batch file to open the folder c:\test and parse through all files in that folder and create a logfile of any that do not have today's date as last modified?


Please provide a DIR listing of the c:\test folder and we'll see what is there.


----------



## Squashman (Apr 4, 2003)

And you could say the same thing about the way Windows has a native way to open ZIP files. It looks like a folder to Windows but the command line is not going to see it as a folder.


----------



## Squashman (Apr 4, 2003)

open up a cmd prompt.
CD to C:\test
Then do a directory listing of folders only: dir /ad


----------



## RastaPickles (Mar 17, 2013)

foxidrive said:


> Please provide a DIR listing of the c:\test folder and we'll see what is there.


The answer is test.dtbx.


----------



## RastaPickles (Mar 17, 2013)

Squashman said:


> open up a cmd prompt.
> CD to C:\test
> Then do a directory listing of folders only: dir /ad


The answer is test.dtbx.

Thank you for your time.


----------



## Squashman (Apr 4, 2003)

I asked to see the output of a command.
There are a few reasons why we need to see the actual output of the commands we asked. We also need to see what the date timestamps look like.


----------



## Squashman (Apr 4, 2003)

foxidrive said:


> I suspect your filenames and information aren't quite accurate and is why your other post was deemed the way it was.


His post was closed on StackOverflow.
http://stackoverflow.com/questions/15453660/checking-a-folder-for-date-time-stamnps


----------



## Drabdr (Nov 26, 2007)

RastaPickles, I have removed your comments regarding the helpers here. If you have any questions, please contact a moderator/ admin.


----------



## Squashman (Apr 4, 2003)

If you would like to have help with this topic we need to see the output of the following two scenarios.

1) Open up a cmd prompt and show a directory listing of the folder C:\test
2) Show a directory listing of the folder C:\test\test.dtb

What I mean by output is this.

```
C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 24B6-8062

 Directory of C:\test

03/17/2013  03:51 PM    <DIR>          .
03/17/2013  03:51 PM    <DIR>          ..
03/17/2013  03:36 PM    <DIR>          dir1
03/17/2013  03:36 PM                 6 foo.txt
03/17/2013  03:52 PM    <DIR>          test.dbt
               1 File(s)              6 bytes
               4 Dir(s)  207,394,820,096 bytes free

C:\test>cd test.dbt

C:\test\test.dbt>dir
 Volume in drive C has no label.
 Volume Serial Number is 24B6-8062

 Directory of C:\test\test.dbt

03/17/2013  03:52 PM    <DIR>          .
03/17/2013  03:52 PM    <DIR>          ..
03/17/2013  03:52 PM                 6 V900.cub
               1 File(s)              6 bytes
               2 Dir(s)  207,394,820,096 bytes free

C:\test\test.dbt>
```
I will add one more. Would like to see the output of this as well.

```
C:\test>echo %date%
Sun 03/17/2013

C:\test>
```


----------

