Computing.Net > Forums > Windows XP > Need to copy Files generated for last 1 hour

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Need to copy Files generated for last 1 hour

Reply to Message Icon

Name: shiva4palz
Date: October 28, 2009 at 23:04:03 Pacific
OS: Windows XP
Product: Microsoft Windows xp professional edition
Subcategory: Software Problems
Comment:

Hi Guys,

Am new to this forum and new in writing batch scripts. Need some help to the below -

Need to create a .bat [schedule task] file for performing below -

1. Search for the files that are generated in last hour
2. Copy last hour generated files from one location to another.

This script will be scheduled to run every hour to keep copying files generated in past 1 hour.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: October 29, 2009 at 00:41:17 Pacific
Reply:

Run this script and post a few lines of the output.

===============================
@echo off > newfile & setLocal enableDELAYedexpansion

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
echo %%~Ta
)


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

M2


0

Response Number 2
Name: shiva4palz
Date: October 29, 2009 at 11:04:16 Pacific
Reply:

Hi M2, Thanks for help...

Here is the output - ran @ 11:35PM IST

29-10-2009 23:34
29-10-2009 23:34
29-10-2009 23:34
01-05-2009 12:32
29-10-2009 19:54
29-10-2009 19:54
20-10-2009 17:52
19-10-2009 18:19
19-10-2009 18:19
01-05-2009 12:53
21-01-2008 07:12
26-07-2009 18:04
15-10-2009 22:12
29-10-2009 23:34


0

Response Number 3
Name: Mechanix2Go
Date: October 30, 2009 at 02:06:06 Pacific
Reply:

@echo off & setLocal EnableDELAYedExpansion

@echo off > %temp%\#
for /f "tokens=* delims= " %%a in ('dir/s/b %temp%\#') do (
set T=%%~Ta
set C=!T:~11,2!
)

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
set T=%%~Ta
set H=!T:~11,2!
if !H! equ !C! (
copy %%a d:\dest
)
)


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

M2


0

Response Number 4
Name: IVO
Date: November 5, 2009 at 07:12:18 Pacific
Reply:

WARNING to the surfers: the question was answered via private messages.


0

Response Number 5
Name: ace_omega
Date: November 5, 2009 at 07:45:01 Pacific
Reply:

Ok so what was the answer because I am working on a simpler project and can not get the %%A to go to another variable so I can pars the dates and times?


0

Related Posts

See More



Response Number 6
Name: Mechanix2Go
Date: November 6, 2009 at 06:53:21 Pacific
Reply:

ace,

LOL What I posted works. Nothing heard from OP.


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

M2


0

Response Number 7
Name: ace_omega
Date: November 6, 2009 at 07:00:17 Pacific
Reply:

Actually it does not work. This command...

set T=%%~Ta

does not set T to any thing and if you echo it it just says echo is off. Here is the code I am using to test with...

@echo off & setLocal EnableDELAYedExpansion
@echo off > %temp%\#
for /f "tokens=*" %%a in ('dir/s/b') do (
  set T=%%~Ta
  set C=!T:~11,2!
  Echo %T%
  Echo %C%
  Pause
  )

Can you tell me what is wrong?


0

Response Number 8
Name: Mechanix2Go
Date: November 6, 2009 at 07:33:02 Pacific
Reply:

"does not set T to any thing"

LOL

===========================
@echo off & setLocal EnableDELAYedExpansion
@echo off > %temp%\#
for /f "tokens=*" %%a in ('dir/s/b') do (
set T=%%~Ta
set C=!T:~11,2!
Echo !T!
Echo !C!
)


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

M2


0

Response Number 9
Name: ace_omega
Date: November 6, 2009 at 07:35:40 Pacific
Reply:

Ok, so the bangs are key. Thanks for the help.


0

Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Need to copy Files generated for last 1 hour

Unable to copy files www.computing.net/answers/windows-xp/unable-to-copy-files/104726.html

copying files 98 to xp www.computing.net/answers/windows-xp/copying-files-98-to-xp/151870.html

Need to add file to tmp folder www.computing.net/answers/windows-xp/need-to-add-file-to-tmp-folder/151729.html