JimNicholson
asked on
Comparing a portion or a file name to a directory name and then moving the file into the appropriate directory.
I am looking to compare a portion of a file name, to a directory name, and move the file that matches the directory name to that matching directory. On top of that, I would also like the user to be able to append a user defined date onto any files it will be moving.
Here is a sample of what I am looking to accomplish using windows scripting (if possible):
Data files reside in \\server1\Share\
Sample File Names:
(there will be hundreds of variations on the file names, possibly multiple files for one ###XXX)
123XYZchk.txt,
456ABCdta.txt,
456ABCchk.txt
Destination is \\server2\share\
Sample Directory Names (hundreds of directories):
\123XYZ\
\456ABC\
I want the script to compare the first 6 characters of the file name in \\server1\Share\, and then move it to the matching directory in \\server2\share\
At some point in this process, I think it may be easiest to do this while all the files are together on \\Server1\Share, I would like a user defined date to appended to the end of all file names.
The final result would look something like this:
1. Prompt for the user to enter a date to append to all files at the end of the file name (before the extension)
2. Append UD Date and then compare the first 6 Characters of the file names on \\Server1\Share\ to existing directories on \\Server2\Share
3. Move the files to the appropriate directories
4. End Result:
\\server2\share\123XYZ\123 XYZdta_mmd dyyyy.txt
\\server2\share\456ABC\456 ABCchk_mmd dyyyy.txt
\\server2\share\456ABC\456 ABCdta_mmd dyyyy.txt
(the '_' in between the file name and date is completely optional, just thought it looked cleaner)
If I could assign a billion points to this, I would. Any help would be greatly appreciated. I am familiar with windows scripting, I have used it quite a bit, but I dont use it enough to create something as complex (or so it seems) as this.
Thanks very much for your help in advance.
Here is a sample of what I am looking to accomplish using windows scripting (if possible):
Data files reside in \\server1\Share\
Sample File Names:
(there will be hundreds of variations on the file names, possibly multiple files for one ###XXX)
123XYZchk.txt,
456ABCdta.txt,
456ABCchk.txt
Destination is \\server2\share\
Sample Directory Names (hundreds of directories):
\123XYZ\
\456ABC\
I want the script to compare the first 6 characters of the file name in \\server1\Share\, and then move it to the matching directory in \\server2\share\
At some point in this process, I think it may be easiest to do this while all the files are together on \\Server1\Share, I would like a user defined date to appended to the end of all file names.
The final result would look something like this:
1. Prompt for the user to enter a date to append to all files at the end of the file name (before the extension)
2. Append UD Date and then compare the first 6 Characters of the file names on \\Server1\Share\ to existing directories on \\Server2\Share
3. Move the files to the appropriate directories
4. End Result:
\\server2\share\123XYZ\123
\\server2\share\456ABC\456
\\server2\share\456ABC\456
(the '_' in between the file name and date is completely optional, just thought it looked cleaner)
If I could assign a billion points to this, I would. Any help would be greatly appreciated. I am familiar with windows scripting, I have used it quite a bit, but I dont use it enough to create something as complex (or so it seems) as this.
Thanks very much for your help in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER