1.

Solve : How to Copy the file in subfolders and move the same file to new folder?

Answer»

I want to COPY the file from subfolder C  (Folder--->subfolder A----> subfolder B------>subfolder C) and move the same file to a new folder.
Kindly assist me. Thanks in advanceTry using the copy command.

Code: [Select]copy "c:\folder\a\b\c\file.doc" "c:\newlocation\"
Hi Raven,
Thanks for your reply.

I think i have not explained the issue properly.

I need to copy *.txt from set of folders->subfolders->subfolders to a specific path.

i.e
C:\>Dir *.txt/s

I want to copy above out put files to a particular path.

should be similar to that of below command.
copy dir *.txt/s d:\text
But this will THROW error.
Hope i have explained clearly

thanks in advance
Jas
 Then try:

Code: [Select]xcopy "c:\folder\a\b\c\*.txt" "c:\newlocation\"

You may need to add some switches if you are needing additional THINGS, like subdirectories created and such. I would at least throw a /c in there so that the entire command completes despite errors which you can then review later. Try typing xcopy /? at the cmd prompt to see a full list of the switches available. If you are looking for everything in the subfolder, just endquote after the folder name: eg. "c:\folder\a\b\c" Quote

I need to copy *.txt from set of folders->subfolders->subfolders to a specific path.

i.e
C:\>Dir *.txt/s

for /f "delims=" %%A in ('dir /b c:\*.txt' ) do copy "%%~dpnxA" "d:\text"
The Poll is coming along nicely... just use xcopy if more than one file ie: xcopy c:\folder\folder\folder x:\destination
 oh and not SURE but file types need{ *.*.whatever} to WORK Quote from: patio on November 28, 2011, 05:09:23 PM
The Poll is coming along nicely...
I don't understand this specific Poll, both options are the same  Quote from: kbit on November 28, 2011, 10:51:25 PM
just use xcopy if more than one file ie: xcopy c:\folder\folder\folder x:\destination
 oh and not sure but file types need{ *.*.whatever} to work

I thnk you can safely ignore this post.
OMG prompt responses ... Tx a ton for every one for their replies....

But ,

Lemme explain you further about my folder structures.
*************
Tree ---> A -->1 -->2 -->3 --> xyz.txt
Tree ---> B -->1 -->2 -->3 --> abc.txt
Tree ---> C -->1 -->2 -->3 --> rxy.txt
Tree ---> D -->1 -->2 -->3 --> tuv.txt
Tree ---> E -->1 -->2 -->3 --> unv.txt
*************
Likewise, we have many folders, which were created by an application.  From the "Tree" directory,  i want to copy all the *.txt files to D:\Test

C:\Tree> Dir *.txt/s  ---- This displays all the txt files from the subdirectories.

My requirement : c:\Tree> Copy Dir *.txt/s D:\Test --- This command will not work, just to tell what is our requirement.

If i apply XCopy in the Tree Directory, it will copies *.txt files with their directories. BUT I NEED ONLY TXT FILES. We will be doing further process with the txt files.

Thanks in advance
Cheers
Jas



Try using the following code snippet:

Code: [Select]cd /d c:\tree
for /r %%A in (*.txt) do copy %%A d:\test

Please let us know either way if it works or not.

If you are trying to run this from the cmd prompt instead of a batch file, only use one "%" for the variable. I.e. %A instead of %%AThis is Awesome.......

Its working....Raven Thanks a lot


Cheers,
Jas


Discussion

No Comment Found