The script below needs a touch up on how to strip off the path of variable ${FILE} so that it works properly in the cp and mv commands. I need to rename the file1.edi to a new path and add the batch # variable.
Example:
I have 2 files under /mfg_edi: file1.edi file2.edi
The $FILE will equal to below when doing "ls":
/mfg_edi/file1.edi
/mfg_edi/file2.edi
When I execute it, I get these results:
File to copy: /mfg_edi/file1.edi --->ok
cp /mfg_edi/file1.edi /mfg_edi/recv/1234/mfg_edi/file1.edi.dat ---->problem
#/bin/csh
umask 000
ls ${mfg_edi}*.*
if ( ! $status ) then
foreach FFILE (${mfg_edi}*.*)
set FILE=$FFILE
echo 'File to copy:' ${FILE}
cp ${FILE} ${mfg_edi_recv}${edi_batch}${FILE}.dat
mv -f ${FILE} /mfg/backup
echo 'File has been moved'
end
endif
The 1234 = ${edi_batch} is a sequential number that gets assigned when I run this script under the program.
Example:
I have 2 files under /mfg_edi: file1.edi file2.edi
The $FILE will equal to below when doing "ls":
/mfg_edi/file1.edi
/mfg_edi/file2.edi
When I execute it, I get these results:
File to copy: /mfg_edi/file1.edi --->ok
cp /mfg_edi/file1.edi /mfg_edi/recv/1234/mfg_edi/file1.edi.dat ---->problem
#/bin/csh
umask 000
ls ${mfg_edi}*.*
if ( ! $status ) then
foreach FFILE (${mfg_edi}*.*)
set FILE=$FFILE
echo 'File to copy:' ${FILE}
cp ${FILE} ${mfg_edi_recv}${edi_batch}${FILE}.dat
mv -f ${FILE} /mfg/backup
echo 'File has been moved'
end
endif
The 1234 = ${edi_batch} is a sequential number that gets assigned when I run this script under the program.