Hey guys,
I'm kinda struggling with a problem here. I hope someone has a solution. What I am trying to establish some code that would establish the drive letters. And then compare two folders against each other. I'm already set when it comes to copying the files. The problem is deleting the ones in the second folder that no longer exists in the first folder. I've tried simply deleting all the files period, however when it came time to update the files by copying I found it took too long.
Here's what I have so far:
@echo off
cd C:\Briefcase\
for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\Briefcase\ set w=%%p
The main problem is that I need the function to be recursive so it can go throughout all the subfolders and delete all the unnecessary files. I've tried so many variables of the for function, but just can't figure out how to get a simple path without the drive letter. If I at least had the path without the drive letter I could then switch it with another one. I've even attempted to use the 'for /r' function which was just useless because I couldn't figure out how to get the a pathname without the drive letter.
Any suggestions would be greatly appreciated.
Thanks
Problems With File Management
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Re: Problems With File Management
I strongly recommend you look into the resource kit's robocopy command. Does just what you want, and in fact is one of the main reasons it was created.
Re: Problems With File Management
Thanks for the reply. Tried it. Worked out great.