i'm looking for a sollution to copy multiple files from different folders to 1 folder.
What I have is that I need to copy files from
c:\Customers\folderA\folderB\files
copy to e:\FolderB\files
The problem is that the "Customers" everytime is different. Also FolderA is different. Only FolderB is the same.
I've tried it with robocopy or with copy. But I always have to fill in the Customers name.
Can some one help me?
So I tried it into powershell
and i came to
Copy-Item -Path C:\customer -Recurse -filter *.xls -Destination e:\folderB -Force
only with this i filter to files and all the folders al copied. And i only want the files in it.
Best Answer
You can use the FOR /D command to loop through the directories in a path:
Let's assume the directory C:\Customers contains:
If we run this simple command script:
We get this output:
So taking that a step further, this command script:
Would run the following commands in sequence:
The output, of course, would be the result of each robocopy command.