You can use Horst Schaeffer's excellent wasfile.exe tool:
for /r c:\particular_folder %i in (*.*) do @wasfile.exe %i created after Today-1 > nul && @copy %i f:\different_location
You can change created and modified per your need:
WasFile, ver. 2.2 (c) 2006-2007, Horst Schaeffer
the time&date of two files (or directories),
the date only, time ignored
the date of a file with TODAY-n (days)
the time&date of a file with NOW-n (minutes)
WasFile this.zip created before that.zip
WasFile this.zip modified after today-8
WasFile File1 [Stamp] [not] before|after|sametime File2 [Stamp] [Option]
WasFile File1 [Stamp] [not] before|after|sametime today-n [Option]
WasFile File1 [Stamp] [not] before|after|sametime now-n
Stamp is either:
created, modified (default) or accessed
(by default second stamp = first stamp)
Options to compare date only, ignore time:
/DateLocal or /DateUTC
(if TODAY is used, default is /DateLocal)
Result by errorlevel:
0: true, 1: false, 255: error (message to STDERR)
by the way when you put (.), does it mean look for any format/kind of
the file? can i just put *.csv instead to search csv file only?
I think you mean (*.*)? Yes, this tells you what set you are interested in. *.csv would isolate just the csv files.
also why are you using @wasfile.exe, nul, @ copy and switch %i (two
You might benefit from reading some web sites for background:
Google batch tutorial for more sites.
In a batch file, @command means don't echo the command line to the screen. Otherwise, you will see both what you asked for as well as what the result was.
The && means 'process what follows if command is successful' and determines this by errorlevel. If I wanted 'was not successful' I would have used ||.
In this case, you read the code as: Is the file newer than my target date, and if yes (&&) copy it to some location. Don't show me any output from my command ">nul"