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 w/o copying folder
Name: javensoong Date: February 22, 2006 at 00:53:02 Pacific OS: WinXP CPU/Ram: Pentium 4/512 Product: Intel
Comment:
Hi experts out there, I would like to use to BAT files to copy all newly modified files from a source folder to a destination folder. Inside the source folder itself consists of subfolders. What I want to copy is just the newly modified files but I code below copies the folder too. What kind of amendments I need to make so that it won't copy the folders. Thanks.
_________________________________________
@echo off
C:\DOS\XSET CUR-DATE DATE MM-DD-YY
IF "%1" == "" GOTO LIST-CUR IF "%1" == "\" GOTO LIST-ALL
:LIST-CUR DIR *.* /O:N | Find "%CUR-DATE%" | xcopy c:\testsource\*.txt c:\testdigi\ /m /e /y GOTO END
Name: Ed in Texas. Date: February 22, 2006 at 02:09:20 Pacific
Reply:
javensoong, perhaps I'm mistaken, been a while, but seems to me that "IF "%1" == "\" GOTO LIST-ALL" should be "IF "%1" == "\" GOTO END"??? The first version tells it to copy the entire thing if there aren't changes. HTH. Ed in Texas.
0
Response Number 2
Name: javensoong Date: February 23, 2006 at 00:05:50 Pacific
Reply:
Hi Ed, Thanks for ur reply
From what I understand, IF "%1" == "\" GOTO LIST-ALL will ask it to go to :LIST-ALL DIR \*.* /O:N /S | Find "%CUR-DATE%" | xcopy c:\testsource\*.txt c:\testdigi\ /m /e /y
ANyway, the copying part is ok. The problem is that if there are txt files in subfolders, I only want to copy the txt files to the destination table instead of the folders. Any idea on that?
0
Response Number 3
Name: Ed in Texas. Date: February 23, 2006 at 02:30:25 Pacific
Reply:
javensoong, sadly, no specifics to offer. Seems to me you should be able to use 'if'or 'if then - else' statements to pinpoint what you want. HTH. Ed in Texas.
0
Response Number 4
Name: javensoong Date: February 24, 2006 at 01:55:54 Pacific
Reply:
Appreciated ur reply. Does that mean I need to loop through each folder to copy those txt files from there?
Summary: In that I'd recently noticed odd behaviour on my laptop, where folder properties/options (for unhiding protected files and also listing known file's extensions) while they could be unticked/ticked and...
Summary: My dad accidently turned the power bar off to my computer. Some folders came back with funky extensions (Norton fixed it). But then I noticed there were some large files with no extensions and realize...