|
Answer» Looking for a method to put a excel file in 1600 folders (all named maintenance). The maintenance folders are in DIFFERENT paths. Looks like this, c / work / customers(around 1600 folders) / each customers folder has a maintenance folder that I would like to place the excel file in. Thanks CkshannCannot be automated... Others may have ideas though.Why can it not be automated? Is there a database that as the paths? Only 1600 paths? Is thee a limit as to how MANY paths can exist?
This should work.
CODE: [Select]@echo off for /d /r "c:\work" %%a in (maintenance*) do if /i "%%~nxa"=="maintenance" copy /b "c:\file.xls" "%%a"That worked perfectly. Thank you 1600 times. I wonder what the formula would be to delete all the "file.xls"files in the locations they were created. CkshannCode: [Select]@echo off for /d /r "c:\work" %%a in (maintenance*) do if /i "%%~nxa"=="maintenance" if exist "%%a\file.xls" del "%%a\file.xls"Thanks, Having trouble getting this to work. This is how I set it up in a test folder.
Code: [Select]@echo off for /d /r "C:\Users\Chris\Desktop\server project\macro test 2" %%a in (maintenance*) do if /i "%%~nxa"=="maintenance" if exist "%%a\testing.xlxs" del "%%a\testing.xlxs"ChrisWhat errors do you get? Does the file actually exist in any of the folders?Yes. I used this to plant the files Code: [Select]@echo off for /d /r "c:\Users\Chris\Desktop\server project\macro test 2" %%a in (maintenance*) do if /i "%%~nxa"=="maintenance" copy /b "c:\Users\Chris\Desktop\server project\macro test 2\testing.xlsx" "%%a" When I run the one to rid the files it GOES to the cmd screen which is blank and black and then shuts. I check the maintenance files and the testing.xlsx is still there Thanks chrisSo sorry...I see what I did. I put xlxs instead of xlsx. I works perfectly. Thank you, Chris
|