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.
Copy files with batch
Name: lekfir Date: January 1, 2009 at 15:09:43 Pacific OS: Windows XP CPU/Ram: a Product: A / A Subcategory: Batch
Comment:
Hello, I am trying to write a script that copies all files in the directory tree to a folder without the folders. Only teh files inside them. For example, I have Folder1\Folder2\Folder3 and I want to copy all files in the 3 sub folders into Folder4. I tried this but it fails: For %%J in (*.*) Do (XCOPY "C:\Folder1\%%J" "C:\Folder2\" /Y) Please Help
Name: Judago Date: January 1, 2009 at 17:46:04 Pacific
Reply:
for /f "delims=" %%a in ('dir drive:\folder1\ /a-d /b /s') do copy "%%~fa" drive:\folder4\
0
Response Number 2
Name: lekfir Date: January 1, 2009 at 23:13:43 Pacific
Reply:
Thanks! That rocks!
0
Response Number 3
Name: lekfir Date: January 2, 2009 at 05:16:34 Pacific
Reply:
Another question, Asuuming That I want to copy only files that Starts with 'Test'. For example, Copy only teh following files from all folders and sub-folders: TestGen1.txt TestGen56Big.csv... Is it possible?
0
Response Number 4
Name: Judago Date: January 2, 2009 at 05:42:05 Pacific
Reply:
Yep, copy also supports wild cards.
for /f "delims=" %%a in ('echo "drive:\path\folder1"^&^&dir "drive:\path\folder1\" /ad /b /s') do >nul 2>&1 copy "%%~a\test*" "drive:\path\folder4"
0
Response Number 5
Name: lekfir Date: January 2, 2009 at 13:57:53 Pacific
Reply:
Thanks! You are great! I will check and tell you my results in the next days! Thanks again and come to visit ;-)
Summary: I want to copy files with a particular file name series from one folder to the other... Fox example...I want to copy all pdf files starting with "A" to a folder called "A Series". How do i do it throu...
Summary: Hello IVO, Thanks for the reply I created a batch file with this content: @Echo Off For /F "tokens=* delims=" %%J in (C:\Documents and Settings\admin\My Documents\email test.txt) Do ( Echo.^<%%J^>>...