BalloutMoe
Board Regular
- Joined
- Jun 4, 2021
- Messages
- 137
- Office Version
- 365
- Platform
- Windows
Hello all,
Looking for some help on moving files to a specific folders if that folder exists if not create it.
For example
I have file names and they can vary by how many words they are.
Mike James 07-13-21.pdf
Christopher R.Ricci 07-13-21.pdf
Christopher R.Ricci 07-13-21_part002.pdf
Bradley T. Jackson 07-13-21.pdf
I would like to move these files into subfolders named, notice Christopher has two files and would like them to be in the same folder.
Mike James
Christopher R.Ricci
Bradley T. Jackson
Any help with this please?
@Echo off
PushD C:\Users\axela\Desktop\Payroll\2001
for %%A in ("* *.*") do for /f "tokens=1*" %%B in ("%%A") do (
If not exist "%%B" MD "%%B"
Move "%%A" "%%B\%%C"
)
PopD
I have the following code but it only takes the first name for the folder and the rest in the file name inside.
Folder names are : Christopher or Mike or Bradley
Filenames are James 07-13-21.pdf, R.Ricci 07-13-21.pdf and ect....
Any ideas?
Thank you
Looking for some help on moving files to a specific folders if that folder exists if not create it.
For example
I have file names and they can vary by how many words they are.
Mike James 07-13-21.pdf
Christopher R.Ricci 07-13-21.pdf
Christopher R.Ricci 07-13-21_part002.pdf
Bradley T. Jackson 07-13-21.pdf
I would like to move these files into subfolders named, notice Christopher has two files and would like them to be in the same folder.
Mike James
Christopher R.Ricci
Bradley T. Jackson
Any help with this please?
@Echo off
PushD C:\Users\axela\Desktop\Payroll\2001
for %%A in ("* *.*") do for /f "tokens=1*" %%B in ("%%A") do (
If not exist "%%B" MD "%%B"
Move "%%A" "%%B\%%C"
)
PopD
I have the following code but it only takes the first name for the folder and the rest in the file name inside.
Folder names are : Christopher or Mike or Bradley
Filenames are James 07-13-21.pdf, R.Ricci 07-13-21.pdf and ect....
Any ideas?
Thank you