| 1. |
Solve : Need command to find a file in subfolders and then move the result.? |
|
Answer» Hello New here - I ... need ... to search for file by extension and after finding it in about 3+ folders deep need to move it to a different folder. about 3+ folders deep doesn't give us a good idea of the actual task. If Lemonilla's code isn't what you need then describe the exact task, giving examples of the extensions needed and the folder structure.I am getting a %%A was unexpected at this time. error message when executing: for /f "delims=" %%A in ('dir test.txt /b /s') do echo copy "%%A" "%c:\new_Location%" Answer to foxidrive: about 3+ folders deep = the file I may be looking for may reside in 3 or more folders deep on my path. path = c:\test\temp\variable\ At this time the example has a test.txt file located on (variable) - folder. (3 folders deep on the path) The name of the "variable" folder may vary each time I run this command. Screen shot below: [recovering disk space, attachment deleted by admin]You only double the % SIGN if you are working within a batch file (because % is the escape character for % /mind=blown). And it doesn't appear you set %C:\new_location% to any value. (Hint: ANYTHING surrounded in % signs is a variable.Try this from the CMD prompt. Does it show the file you are looking for? Code: [Select] for /r "c:\test\temp" %a in (test.txt) do echo copy "%a" "c:\new\location"Foxidrive - That worked perfectly.... Thanks a bunch for all who have helped me with the project. |
|