Simple MoveFile wont work

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
lab rat
Newbie
Posts: 4
Joined: Thu Sep 19, 2002 6:03 pm
Location: Ashland,KY

Simple MoveFile wont work

Post by lab rat » Mon May 31, 2004 3:21 pm

Hi, I'm trying to get a simple script to work that moves or copies a file from a PC to a network share.

CopyFile>c:\lab_files\lab-reports\pharmacy\crea20040531.txt,y:\crea\crea20040531.txt

The above to works! However, when I try to use wildcards it wont work, eg. crea*.txt or crea*.* doesn't work. There are numerous files in the destination & source folder named creayyyymmdd.txt. I'm willing to not keep the source files if I could get a MoveFile to work with a wildcard. The true destination folder is g:\users\pharmacy\lab_reports\ crea\ if that matters. I'm running xpp w/ v7.2.036.

TIA!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon May 31, 2004 4:15 pm

Are you also using wildcards in your destination?

Please provide samples of the exact script lines that do not work. Seeing what does work is good, but seeing what doesn't is better.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Mon May 31, 2004 8:46 pm

As I seem to remember - the asterisk "*" is only working if used as an equivalent for a whole string, eg.

*.* // for all files regardless which file extension
*.txt //for all txt files
MyFile.* //all files named MyFile regardless which file extension

if only a part of a string/file name should be filtered/wildcarded you've to use the questionmark character "?" for each character (someone wanna correct me ?)
CopyFile>c:\lab_files\lab-reports\pharmacy\crea????????.txt,y:\crea\*.*
Wanna check only for files from may ?
c:\lab_files\lab-reports\pharmacy\crea20040531.txt,y:\crea\crea????05??.txt
In this case only files which name starts with "crea" should be identified.
Have a try. If not, check if it works with plain DOS!
Run Program>cmd copy c:\lab_files\lab-reports\pharmacy\crea????????.txt,y:\crea\*.*
Additionaly you should have a look at DOS' xcopy command ...

cmd = NT/W2K/XP
command = W9x/ME

Lumumba

Post by Lumumba » Mon May 31, 2004 8:53 pm

And of course DOS' move command should solve your issue if you're not interested to do a copy+delete instead of it.

lab rat
Newbie
Posts: 4
Joined: Thu Sep 19, 2002 6:03 pm
Location: Ashland,KY

Post by lab rat » Tue Jun 01, 2004 3:03 pm

copyfile>......\crea????????.txt,y:\crea\crea????????.txt .......\crea*.txt,y:\crea\crea*.txt .......\crea*.*,y:\crea\crea*.* c:\.....\crea20040531.txt,y:\crea\crea20040531.txt . prompt. Going to look for the proper change directly cmd to see if that's what it's wanting... Thx!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Jun 01, 2004 3:50 pm

cmd copy c:\lab_files\lab-reports\pharmacy\crea*.txt,y:\crea\crea*.txt
needs to be changed to
cmd /c copy c:\lab_files\lab-reports\pharmacy\crea*.txt y:\crea\crea*.txt
by removing the comma and inserting a space.
Last edited by Bob Hansen on Tue Jun 01, 2004 8:32 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Jun 01, 2004 3:54 pm

Have you tried changing from
copyfile>......\crea????????.txt,y:\crea\crea????????.txt .......\crea*.txt,y:\crea\crea*.txt .......\crea*.*,y:\crea\crea*.* ......\crea????????.txt,y:\crea\*.*
copyfile>.......\crea*.txt,y:\crea\*.*
copyfile>.......\crea*.*,y:\crea\*.*
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

lab rat
Newbie
Posts: 4
Joined: Thu Sep 19, 2002 6:03 pm
Location: Ashland,KY

Post by lab rat » Tue Jun 01, 2004 5:21 pm

Bob, I couldn't get any of those combinations to work. I did get the RunProg>cmd line to work.

The below doesn't work for me:

cmd copy c:\lab_files\lab-reports\pharmacy\crea*.txt,y:\crea\crea*.txt

However, this line does:

cmd /c copy c:\lab_files\lab-reports\pharmacy\crea*.txt,y:\crea\crea*.txt

The /c switch was needed to get it to execute the copy... Thanks for the help!

John

Guest

Post by Guest » Tue Jun 01, 2004 6:17 pm

As I seem to remember - the asterisk "*" is only working if used as an equivalent for a whole string ... if only a part of a string/file name should be filtered/wildcarded you've to use the questionmark character "?" for each character (someone wanna correct me ?)
Oooops, you proved me wrong :oops:

Sorry if I've confused someone somewhere ... :roll:

Lumumba

Post by Lumumba » Tue Jun 01, 2004 6:21 pm

There's still the need for a headbanging smile ... :oops:
The above was me.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts