Delete Then Copy New Files

April 27, 2010 at 17:13:56
Specs: Windows XP
I tried searching the forums for my answer but I'm not too programming savvy to know what to use. I apologize if this has been asked elsewhere...I want to create a simple batch file to go out on my mapped network drive and delete a folder then copy a folder from my hard drive out to that same network drive. I don't want to overwrite the folder - I want to delete then copy in a new folder. Here's an example of what I want...

1) Delete Z:\TestFolder - this is a mapped drive and I want to delete "TestFolder".
2) Copy C:\TestFolder to Z:\
The problem I am running into is although the mapped drive is Z:\ it shows in my Windows Explorer as something like:
myname on 'Folder\App\Transfer\' (Z:)

I hope I explained this well enough for someone to help me. I really appreciate any help I can get!

See More: Delete Then Copy New Files

Report •

April 27, 2010 at 18:32:37
your windows explorer should not hamper the batchscript,
so this should work:
@echo off
del z:\testfolder
copy /y testfolder z:\

don't know why you need to delete first, but you must have your reasons.

Report •

April 28, 2010 at 11:20:50
Thanks for the code! I tried it and it didn't work however. Maybe it's how my employer maps the drive. The reason I'm deleting first instead of just copying is the folder often changes the files that are in it. Although the unused files wouldn't be a problem; they would just be taking up space (I'm a clutter freak!)

Report •

Related Solutions

Ask Question