New
#1
Help batch file to move files in list to created subdirectory
Please excuse me in advance because I am not very experienced making batch files. I'm not asking for a free lunch and would gladly paypal someone some cash for a working batch file.
I have a parent folder that contains several subfolders. Each subfolder has several files in them. I need a batch file to search all the folders starting from the parent folder for files contained in a list.txt file and if it finds a match create a new folder where each file was found and move the found file to that folder.
File names in list.txt: (no extension)
test1
test2
Before batch run:
Parent
|--Sub
| |--test1.zip
| |--foo.zip
| |--foo1.zip
| |--foo2.zip
|
|--Sub2
| |--test2.zip
| |--foo.zip
| |--foo1.zip
| |--foo2.zip
After batch run:
Parent
|--Sub1
| |--NewSub
| | |--test1.zip
| |
| |--foo0.zip
| |--foo1.zip
| |--foo2.zip
|
|--Sub2
| |--NewSub
| | |--test2.zip
| |
| |--foo0.zip
| |--foo1.zip
| |--foo2.zip
I have made every effort to do this on my own and keep failing.
Thanks in advance.
I've managed to get this to work but would like to make it create subfolders where the files are found. I would also like to use move instead of xcopy if possible.
Code:for /f "delims=" %%i in (list.txt) do xcopy "C:\Users\BEAZLEYBUB\Desktop\New folder\New folder\%%i?" "C:\Users\BEAZLEYBUB\Desktop\New folder\Copied" /i /z /y /s pause
Last edited by beazleybub; 18 Nov 2015 at 21:58.