Computing.Net > Forums > Programming > Batch sript to copy the folders modified toda

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Batch sript to copy the folders modified toda

Reply to Message Icon

Name: kiranyeruva
Date: June 11, 2009 at 06:45:48 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

Hi,

I need a batch script to copy the today modified sub-folders of a folder to a new folder.

Ex:

Folder "f:/test1" is having total 5 sub-folders and I want to copy only today created/modified sub-folders from "f:/test1" to "f:/test2" folder.

I have the following script whis is only copying the today modified files but not the folders.

Please help to resolve this issue.

--------------------------------
::Copy Files Made Or Modified Today
@echo off
setlocal
set source=f:\test12
set dest=f:\test23
pushd "%source%"
set t=%date:~4%
for /f %%a in ('dir /b /a-d /o-d') do call :PROCESS "%%a"
goto :eof
popd

:PROCESS
echo %date:~4%
for /f %%j in ('echo %~t1') do set d=%%j
if "%d%"=="%t%" copy "%1" "%dest%"
goto :eof

---------------------------------



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: June 11, 2009 at 18:09:09 Pacific
Reply:

because you are using the switch /a-d . check dir /? to use correct switch for folders


0
Reply to Message Icon

Related Posts

See More


Clear screen in java Text... copy files but compare t...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch sript to copy the folders modified toda

batch file to copy to many folders www.computing.net/answers/programming/batch-file-to-copy-to-many-folders/17504.html

Batch Job to Copy folders www.computing.net/answers/programming/batch-job-to-copy-folders-/18383.html

Batch file to copy folder www.computing.net/answers/programming/batch-file-to-copy-folder/17404.html