|
Answer» I'm trying to copy all the files within a tree to another folder.
I can't get this to work. I have the folder "main" and within the folder I have the folders "tree" (where the files are) and "new" where I want to MOVE the files too. The .bat FILE is in the "main" folder.
Code: [Select]FOR /R tree %%P IN (*.*) DO COPY %%P new I have no experience with DOS and I am wondering if I put in the variables correctly. Thanks in advance.If tree and new are the actual directory names, then the code will work. The new directory must be a subfolder of main.
You're not doing anything destructive, but if you have any doubts change copy to echo and see what will happen without actually doing anything.
Good LUCK. The system cannot find the file specified.
I'm running Windows XP if that makes a difference.I can't see your system, so are tree and new the actual directory names? Try using full path names for both the source directory and the target directory. This will eliminate any confusion as to where the batch file needs to look.
The new directory needs to exist prior to running your batch code. Copy does not make directories.
If tree and new are placeholders (variables) for directory names, they need to be enclosed in % symbols.
Good luck. YEAH tree and new are the directory names and I am now using full path names and it does not even run. The directory new already exists.This is turning into a chat room.
Quote I have the folder "main" and within the folder I have the folders "tree" (where the files are) and "new" where I want to move the files too
Is this your directory structure:
Main | |__tree |__new
There are other variations of the for command that might help here:
Code: [Select]echo off for /f "tokens=* delims=" %%p in ('dir tree /s /b') do ( copy "%%p" new )
It WORKED!!! Thank you so much!!!
|