Jump to content

Help Needed Please on file management.


Recommended Posts

Hello, 

  thank you for your time and help.    How can I do the following process:

in a specific foler (let´s say folder name is  Data)  I have a lot of  .mdb  files, and more are created every day.  I need to read the latest one, so, I´m thinking of copying it to always the same file name using the line comand  copy  "file".mdb  myfile.mdb /y     (/y switch is to overwrite without prompting).

"file"  is the last file created on the  Data folder.  How do I know which file is the latest one every time?

More info:

I have, for example,     1515_May27  file as the latest file,   in 2 hours (or any other time), I will have 2020_May27   file,   tomorrow, I will have  1515_May28   4040_May28

so,  today, I need to:

copy 1515_May27.mdb   myfile.mdb /y

in 2hours, I need to

copy 2020_May27.mdb  myfile.mdb /y

tomorrow

copy 1515_May28.mdb  myfile.mdb /y

and later

copy 4040_May28.mdb  myfile.mdb /y

 

that is,  I will be reading  myfile.mdb all the time, but that will be created by copying from a different source every time, the source will be the latest file created on the Data folder.  How do I know which is the latest file on the folder?

need help with the script pls.

Thx a lot!!

Link to comment
Share on other sites

Thx JohnOne for the answer, but,  could you pls be more specific?  I was reading about the instruction and trying it out, but don´t get what I need.  Is it possible to provide a sample script on how to use the instrucion FileGetTime() and from there, get the file name?

thx again,

Link to comment
Share on other sites

Hi,

You can doing this way:

#include <FileOperations.au3> by AZJIO

(

Use _FO_FileSearch to read the folder content and put in into array

Using For ... Next, read the file date using FileGetTime() and compare it with today's date using _DateDiff

Hope you get the idea :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...