Re: Copy file with multiple names



I appreciate your assistance helping me with the wildcards. I think you may
be reaching to assume thet I use a flawed concept just because I do not take
the time or space to fully explain built in redundancies in my processes,
however you must take satisfaction in these assumptions so I hope you also
accept my gratitude for your help.

Rest assurred, my processes will run barring two server shut downs and in
that case I have far greater problems than repairing this particular program
execution.

Thanks
--
Jeff C
Live Well .. Be Happy In All You Do


"Pegasus (MVP)" wrote:

I would have been negligent if I had not pointed out that
there is a flaw in your concept. Since you're now aware
of it, here are a couple of quick ways of doing this. There
are, of course, others.

a) With a batch file:
@echo off
copy /y "Q:\*.20071011024021.txt","U:\DocDirectReports\name.txt"

b) With a script file:
Option Explicit
Dim objFSO, ObjWshShell, ObjExec, objFile, Name
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set ObjWshShell = WScript.CreateObject("WScript.Shell")
Set ObjExec = ObjWshShell.Exec("%ComSpec% /c dir /b /a-d
Q:\*.20071011024021.txt")
If ObjExec.ExitCode=0 Then
Do
Name = ObjExec.StdOut.ReadLine
Loop Until LCase(InStr(Name,"20071011024021.txt")) > 0
Set objFile = objFSO.GetFile("Q:\" & Name)
objFile.Copy("U:\DocDirectReports\name.txt")
End If

"Jeff C" <JeffC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E8B29907-4EAD-4078-B34D-8F71C7C30A2B@xxxxxxxxxxxxxxxx
I appreciate your advice on the broad scope of having an appropriate
process
in place, but I was asking for assistance on the script. I just don't see
the need to explain the entire process behind my need for a script.
Explaining the entire process seems to be a needless waste of space in
this
forum and in the past no one has ever required me to do so. Having a
dozen
similar process set up and running I was just trying to get this new one
off
the ground.

It would be nice of you and appreciated if you would assist with the
script,
that is the point of this forum judging by most of the other posts.
--
Jeff C
Live Well .. Be Happy In All You Do


"Pegasus (MVP)" wrote:

I realise that you have a mechanism in place for deleting
old files. However, a robust program must be able to
deal with exceptions. If your program does not run one
day for some unexpected and unforeseeable reason then
you will have two files of the form "name.#####.20071011024021.txt".
From that day onwards your program will fail unless you plan
right now for this contingency. If you don't then you're planning
for failure.



"Jeff C" <JeffC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:62B4BCB2-DD7D-49C8-8624-FE437E256C49@xxxxxxxxxxxxxxxx
I did not think to explain the entire process I had in mind. I
routinely
use
a program called docuanalyzer inwhich I build a model for data
extraction.
I
automate this exporting the extracted data into a usable form then
compile
the data using scheduled macros in MS Access. Using ODBC linked
spreadsheets
I have automated pivot table reports generated from data.

These are a new data source for me and I have never tackled this type
of
naming convention. The other spooled reports I get overwrite
themselves
each
day with the same name.

Once I append the new data to my data tables I would delete the files
and
leave the destination folder empty for the next days files to come
down.

Thanks for your help, hope you can assist me.
--
Jeff C
Live Well .. Be Happy In All You Do


"Pegasus (MVP)" wrote:


"Jeff C" <JeffC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:76780D24-C1ED-46D1-B41A-B31D8ACB3114@xxxxxxxxxxxxxxxx
I was finally able to get some mainfraim reports spooled to download
to
text
files every morning rather than useing Document Direct. The problem
is
that
for every report that comes down every morning there are multiple
copies
with
names the same followed by "name.#####.20071011024021.txt" for
example.

I have been unsuccessful getting a script to move and rename the
file.

So Far:

Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFile "Q:\name*.txt","U:\DocDirectReports\name.txt", True

Can anyone assist?

Thanks in advance
--
Jeff C
Live Well .. Be Happy In All You Do

Before you decide HOW to do this, you need to work out
WHAT you want to do. Just renaming the files will not really
work: Sooner or later you will have two of these reports, and
you obviously cannot rename both to the same name. What
now?









.