Computing.Net > Forums > Programming > Copying Files from Nested folders

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.

Copying Files from Nested folders

Reply to Message Icon

Name: sunitha_1984
Date: October 30, 2009 at 02:34:04 Pacific
OS: Win Server 2003
CPU/Ram: intel
Product: Microsoft Windows server 2003 enterprise
Subcategory: Batch
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: sunitha_1984
Date: October 30, 2009 at 04:14:16 Pacific
Reply:

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


0

Response Number 2
Name: Mechanix2Go
Date: October 30, 2009 at 04:57:11 Pacific
Reply:

@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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


PKUNZIP Error Batch Program


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Copying Files from Nested folders

Copying files from one driver hive to another www.computing.net/answers/programming/copying-files-from-one-driver-hive-to-another/18970.html

script to copy files from a server www.computing.net/answers/programming/script-to-copy-files-from-a-server-/16825.html

copy files from folder A to folder B .... www.computing.net/answers/programming/copy-files-from-folder-a-to-folder-b-/20177.html