Solved copying through command line

July 19, 2012 at 12:02:21
Specs: Windows XP
Hello All,

I wanted to copy a folder which was of latest date modified, but i need to copy only those folders
which starts with particular word,

Example is shown below... PLZ help
NOTE: code needed in command line..

D:\a\b\abcde_18 (Date created 18-07-12)
D:\a\b\abcdf_17 (Date created 18-07-12)
D:\a\b\abcde_16 (Date created 17-07-12)
D:\a\b\abcdh_15 (Date created 16-07-12)
D:\a\b\abcde_14 (Date created 18-07-12)

i need to copy the abcde_18 file to other folder.

tried using dir D:\a\b\abcde* /b/o:-n/s but the prompt is hanged..
o/p is


See More: copying through command line

Report •

July 19, 2012 at 18:14:24
Do you actually want all subdirectories scanned, or just the one? If just the one, you should remove the /s option from the "dir" command. If there is alot of downstream material, the recursion would waste alot of time and prob'ly make the command appear to "hang".

Report •

July 21, 2012 at 03:20:36
i just want to check for the directory and the latest modified or created folder should be copied...

Report •

July 21, 2012 at 18:35:47
✔ Best Answer
@echo off & setlocal enabledelayedexpansion
:assumption: latest date/time is also highest-numbered file. may be wrong...
for /f %%a in ('dir /b /o:-d d:\a\b\abcde_*') do (
copy "%%a" otherfolder
goto :eof
(not tested)

Report •
Related Solutions

Ask Question