| 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. I need to copy *.txt from set of folders->subfolders->subfolders to a specific path. 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 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 |
|