Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yuri Rubinov
  Where is Yuri Rubinov?
 Philadelphia
 Pennsylvania - United States
 Yuri Rubinov
 To: Yehuda Epstein
  Where is Yehuda Epstein?
 Monsey
 New York - United States
 Yehuda Epstein
 Tags
Subject: RE: Files modified date
Thread ID: 188996 Message ID: 189026 # Views: 1 # Ratings: 1
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Wednesday, August 13, 2008 2:20:14 AM         
   


> >
> > If you wish to identify the file date, then adir creates the array having file modification date. If it is the "file date" you are looking for, then you may sort the array by column 3 (asort(...,3)), search it for particular date, and scan the rest of array copying files.
> >
> >
> > Best Wishes,
> >
> > Yuri Rubinov
>
> Thanks Yuri,
> I must say, I tried to put some logic thread together, but can not yet. I know that Adir (the way I use it) passes a single file's modified date to a variable, but in my case there are several files, which only some of them have that modify date I am interested in, and the only value I know of is this modified date. Can we relate to an example?
> let's say that under c:\temp\ I have the following 3 files with their modified dates.
> ab.txt with modified date of 02/01/2008
> cd.txt with modified date of 01/01/2008
> ef.txt with modified date of 02/01/2007
>
> I am interested in copying all the files in c:\temp\ that carry a modified date of >= 01/01/2008 to c:\temp1\, and I do not know the files name, or even how many are there in c:\temp\<br />>
> How do I put your advice into code to resolve it?
>
> Thanks,
> Yehuda.

How many files do you expect in the directory?
For not so many files (~13000) you can use something like this:

clear
lcSrcdir="c:\temp1\"
lcTargetDir="c:\temp\"
ldstartdate={^2008-01-01}
IF NOT DIRECTORY(lcTargetDir)
	?"1. ???"
	return
endif
release afiles
if adir(afiles,lcSrcdir+"*.*") <=0
	?"2.???"
	return
ENDIF

for ia=1 to alen(afiles,1)
	IF afiles(ia,3) >=ldstartdate
		IF FILE(lcTargetDir+ afiles(ia,1))&& what if the file already there ? just delete it
			ERASE (lcTargetDir+ afiles(ia,1))  && what if the file already there ? just delete it
		endif
		COPY FILE (lcsrcdir + afiles(ia,1)) TO (lcTargetDir+ afiles(ia,1))
	endif
endfor



Best Wishes,

Yuri Rubinov

ENTIRE THREAD

Files modified date Posted by Yehuda Epstein @ 8/12/2008 10:05:37 PM
RE: Files modified date Posted by Yuri Rubinov @ 8/12/2008 10:17:55 PM
RE: Files modified date Posted by Yehuda Epstein @ 8/12/2008 11:21:40 PM
RE: Files modified date Posted by Yuri Rubinov @ 8/13/2008 2:20:14 AM
RE: Files modified date Posted by Yehuda Epstein @ 8/13/2008 5:35:12 PM
RE: Files modified date Posted by Yousfi Benameur @ 8/13/2008 12:22:04 AM
RE: Files modified date Posted by Cetin Basoz @ 8/13/2008 12:55:38 PM
RE: Files modified date Posted by tushar @ 8/13/2008 2:57:04 PM
RE: Files modified date Posted by Samir Ibrahim @ 8/13/2008 5:18:06 PM