Re: Dos batch file to sort files based on file names.
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Mon, 19 May 2008 22:22:24 +0200
"Jon Osborn" <josborn@xxxxxxxxx> wrote in message
news:OcgHkweuIHA.516@xxxxxxxxxxxxxxxxxxxxxxx
The batch file you quote came out of my own kitchen.
What you want to do can be done but we first need to
remove some ambiguities.
You state "And we want the files sorted into these folders".
I doubt very much that you mean "sorted". To sort means
"to arrange in a specific order". Do you perhaps mean
"And we want the files MOVED into these folders"?
Yes I did moved. I am not worried about the order once the move in to
thier correct order.
Here is one of the examples you gave: The file
Job-01C8A969-546C46C2_CurTMGPCD Little Rock.m2t
is supposed to be sorted/moved to this folder:
D:\contents\Little Rock
Are you trying to say that the batch file should remove
the first 32 characters of the file name (i.e. the
"Job-01C8A969-546C46C2_CurTMGPCD " bit, then
grab the remaining characters of the file name up to the
full stop, then use this string for the target folder?
This batch file doesn't need to worry removing characters. I have already
created a bat that should strip the fist 22 Chars (ex
Job-01C8A969-546C46C2_) leaving what is left of the file name. This batch
file just need to move any file with "Little Rock" in to the "Little Rock"
Folder.
If this is correct, why do you move the file
Job-01C8AA07-BA24389A_CurTQGPCP General Resellers.m2t
to the "General" folder? This example does not follow
your rule!
This one is Policital in the company, they are part of one of the
locations but they want thiers files sorted out "special" for them.
And what about this example:
Job-01C8A970-E8E940DA_CurTMGPCPLittleRock.m2t
It lacks the space to the left of the word "Little". It also lacks
the space between "Little" and "Rock".
I know, I am try to get the report write to remove all spaces from her
file names. I figure if I can't we don't have any ither offices with
little their name so I would use that as my name to sort from.
What should happen if the file to be moved already exists
in the target directory?
I will use the Move /Y command so they will be overwritten.
What is this "Lost and found" bit you're referring to?
Incase a new report is created and it is not labeled for a specific
location. I want to know where to look when Management asks about. I
Also wnat to keep the soruce folder clean of files.
Can your file names contain any of the following "poison"
characters? % ^ & ( ) = ! ' ". Lots of file names do!
No. They will never have any of those charaters.
These are design questions you need to think about very
carefully BEFORE you start any coding effort.
Thanks,
Jon
If you already have the code to extract the destination
folder then you should post it so that it can be properly
integrated into the overall scheme of things. Alternatively
you could ask some specific questions about things that
are unclear at the moment.
.
- References:
- Dos batch file to sort files based on file names.
- From: Jon Osborn
- Re: Dos batch file to sort files based on file names.
- From: Pegasus \(MVP\)
- Re: Dos batch file to sort files based on file names.
- From: Jon Osborn
- Dos batch file to sort files based on file names.
- Prev by Date: Re: Dos batch file to sort files based on file names.
- Next by Date: Re: Dos batch file to sort files based on file names.
- Previous by thread: Re: Dos batch file to sort files based on file names.
- Next by thread: Re: Dos batch file to sort files based on file names.
- Index(es):
Relevant Pages
|