I am having some troubles creating a batch file...I have searched and searched and made it a little bit of the way on my own and was hoping someone could help me out.
What I am trying to do is as follows:
Search a directory with many sub directories for a certain file type (lets say a .txt file)
If the script finds this file I would like a Folder created called Sample in the directory the .txt file was found
Then move the .txt file to this Sample folder
And if the script finds the file in a folder already named Sample to do nothing and continue on.
I have this as my batch so far and it works in finding the file and moving it to the Sample folder, the only problem is the Sample folder is created in the root of where i ran the batch file and all .txt files found are moved to this folder. Close but not quite right.
@echo off & setlocal EnableDelayedExpansion
for /R %%a in (*.txt) Do (
move %%a "Sample" )
An example of the directories I am talking about would look like this.....
once the batch script runs I would like the directories to look like this
Thanks in advance for your wisdom.