How to move files based on first three chars

Closed
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
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 replies

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
What OS ? Windows or UNIX
0
Hello rizvisa1;

It's windows 2008 server or Windows 7
0
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
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