Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to move files based on file name to folder with same name

Status
Not open for further replies.

dkriese

Technical User
May 18, 2003
17
0
0
US
I have 1000 files/documents saved with last and first names, I need to move these files/documents to their respective folders that also have last name first name. I would like the script to read the last name and move it to the folder with the same last name, some sort of script or batch file would do.
 
All I have done so far is to search the internet for a solution, tried robocopy, didnt have what I need. I did move all the documents to the base directory named client dat, where there are subfolders for each client name and the documents are also named by client name. each folder and document has two names with a space inbetween, I need the script to read the first part of the file name match it to the folder and move the document into that folder. I used a utility to remove commas from the file name, that worked ok. I had a script to do this a long time ago and can't find it, as I never had use for it until now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top