How to move files based on first three chars

Closed
Ghozty - Aug 22, 2010 at 08:56 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Aug 26, 2010 at 08:32 AM
Hello,

I would like to move files based on first three chars to related directory.

Here is the example:

AABC001.txt should go to .\A\A\B\
ABCD001.txt should go to .\A\B\C\
BCDA001.txt should go to .\B\C\D\
DEFG009.txt should go to .\D\E\F\
and so on...

I would like to use a command line script or even an utility doing this is enough for me!

Thanks;

2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 24, 2010 at 08:47 AM
What OS ? Windows or UNIX
0
Hello rizvisa1;

It's windows 2008 server or Windows 7
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 26, 2010 at 08:32 AM
You can use visual basic scripting for that. I dont know how you plan to move the file. I mean is your plan to target a directory and have all files move to the right location or your plan is you would enter a file name and it needs to be move. or may be it is based of some text file etc. What ever is the way, you can easily accomplish that with visual basic scripting by using "FileSystemObject" in it. Search for Scripting.FileSystemObject and you will see how easy and verstile it is to use
0