ceez Posted May 18, 2005 Share Posted May 18, 2005 Zup peeps!?I want to create a batch file that copies files from a directory but does not copy folders from that directory. I checked the xcopy & copy command options with the /? switch but they dont say anything about not copying dirs.Is it possible?Thkzceez Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 18, 2005 Share Posted May 18, 2005 For more complex copying command use robocopy from resource kit - it is really great tool! Microsoft released tools in this order (Easy_to_use ---> more robust)Copy - xcopy - robocopy Link to comment Share on other sites More sharing options...
ceez Posted May 18, 2005 Author Share Posted May 18, 2005 @soulin, thkz for the info, found robocopy and it has an exclude option which i could use for the foldes, but if new folders are created then I would have to tweak the batch file every time. I will give it a try anyways,Any other ideas? Thkz again,ceezPS- i cant even get it to work, the command just scrolls down the cmd prompt non-stop.this is what I am testing.C:\A <- folder has source files and foldersC:\B <- destination folder for everything in A (including the folders for now)Using the followin in my batch:robocopy c:\a\*.* c:\b\pauseexitWhen I run it all I get is the command scrolling down and nothing gets copied, it's not a lot of files either. help.PS 2 - I just found out that the copy command apprently DOES NOT copy directories. I just tried the above commands but used "copy" and when I checked the B folder it had all the files an no dirs...cool....well that seems to be the end of my mission.thkz Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 18, 2005 Share Posted May 18, 2005 You are not using the command with right syntax:robocopy c:\a c:\b to copy filesrobocopy /s c:\a c:\b to copy files + directories Link to comment Share on other sites More sharing options...
SiMoNsAyS Posted May 18, 2005 Share Posted May 18, 2005 have u read the help? copy /?xcopy /?*absence of* parameters /S and /E should be of your interest Link to comment Share on other sites More sharing options...
Yzöwl Posted May 19, 2005 Share Posted May 19, 2005 COPY C:\OLDdir\*.* C:\NEWdirIf you try to copy multiple files to a subdirectory that does not exist, using copy, the subdirectory will not be created, you would need to first 'make' the 'directory', (MD), therefore IF NOT EXIST C:\NEWdir MD C:\NEWdirCOPY C:\OLDdir\*.* C:\NEWdirNow if C:\OLDdir cannot be found, you will get an error and will have created a directory for no reason, thereforeIF EXIST C:\OLDdir ( IF NOT EXIST C:\NEWdir MD C:\NEWdir COPY C:\OLDdir\*.* C:\NEWdir)I hope this helps to show you how you 'build' a batch script using a series of small steps! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now