Articles

Copying Files from Nested folders

October 30, 2009 at 02:34:04
Specs: Win Server 2003, intel

HI ,

I have to copy some files from a folder which has a nested folder structure i.e the main parent folder will have some child folders and inside these child folders there will be some files.FIles can be inside the child folder i.e 3 to 4 levels down the parent folder or the files will be 1 level.

I have to write a batch script which will extract all these *.* files to one one location with out copying the child folders.

I tried using the below script but it is not giving the correct out.

for /R C:\Premium\ %%f in (*.*) do copy %%f c:\Premium_Due

Please help me how can i do this.

--Sunitha


See More: Copying Files from Nested folders

Report •


#1
October 30, 2009 at 04:14:16

I tried the below script

xcopy C:\A\*.\*test.txt C:\B

but I am getting invalid no of parameters , Please tell me where the issue is.

--Sunitha


Report •

#2
October 30, 2009 at 04:57:11

@echo off & setLocal EnableDELAYedExpansion

for /f "tokens=* delims= " %%a in ('dir/s/b/a-d C:\Premium') do (
copy "%%a" d:\some\other\place
)


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

M2


Report •

Related Solutions


Ask Question