Computing.Net > Forums > Windows XP > Copy files w/o copying folder

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

Reply to Message Icon

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

:LIST-ALL
DIR \*.* /O:N /S | Find "%CUR-DATE%" | xcopy c:\testsource\*.txt c:\testdigi\ /m /e /y

:END
SET CUR-DATE=




Sponsored Link
Ads by Google

Response Number 1
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?


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


windows could not start b... Data validation code(exce...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Copy files w/o copying folder

Stop users from copying folder/file www.computing.net/answers/windows-xp/stop-users-from-copying-folderfile/164628.html

Hide extensions for known files www.computing.net/answers/windows-xp/hide-extensions-for-known-files/171844.html

Folders became files w/o extension! www.computing.net/answers/windows-xp/folders-became-files-wo-extension/63747.html