Simple MoveFile wont work
Moderators: Dorian (MJT support), JRL
Simple MoveFile wont work
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!
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!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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 ?)
Have a try. If not, check if it works with plain DOS!
cmd = NT/W2K/XP
command = W9x/ME
*.* // 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 ?)
Wanna check only for files from may ?CopyFile>c:\lab_files\lab-reports\pharmacy\crea????????.txt,y:\crea\*.*
In this case only files which name starts with "crea" should be identified.c:\lab_files\lab-reports\pharmacy\crea20040531.txt,y:\crea\crea????05??.txt
Have a try. If not, check if it works with plain DOS!
Additionaly you should have a look at DOS' xcopy command ...Run Program>cmd copy c:\lab_files\lab-reports\pharmacy\crea????????.txt,y:\crea\*.*
cmd = NT/W2K/XP
command = W9x/ME
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
needs to be changed tocmd copy c:\lab_files\lab-reports\pharmacy\crea*.txt,y:\crea\crea*.txt
by removing the comma and inserting a space.cmd /c copy c:\lab_files\lab-reports\pharmacy\crea*.txt y:\crea\crea*.txt
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!
Bob
A humble man and PROUD of it!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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!
Bob
A humble man and PROUD of it!
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
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
Oooops, you proved me wrongAs 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 ?)
Sorry if I've confused someone somewhere ...