Problem with moving a file to another dir.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with moving a file to another dir.
# 1  
Old 05-30-2011
Problem with moving a file to another dir.

Hi frnds

The following is the code

Code:
#!/bin/ksh

##############################################################
#                                                            #
# Created by eDB Dev - 27-May-2011                           #
#                                                            #
# ServiceFeeDetail.ksh                                       #
#     Script for loading the ServiceFeeDetail files          #
#     sent by HCR DATABROKER into the EDB Stage Tables       #
#                                                            #
#     Parameters:                                            #
#        Input Directory                                     #
#        Processed Directory                                 #
#        Working Directory                                   #
#                                                            #
##############################################################
##Script property file
 $EDB_APP_PATH/scripts/EDBScriptProperties.ksh

START_DATE_TIME=`date +"%Y-%m-%d_%H-%M-%S"`

#USAGE="$0 PLEASE ENTER THE FOLLOWING ARGUMENTS 1)INPUT_DIR 2) PROCESSED_DIR 3) WORKING_DIR  4) LOG_DIR 5)USER_ID "

INPUT_DIR=$EDB_DATA_PATH/ServiceFeeDetail/Inbound
PROCESSED_DIR=$EDB_DATA_PATH/ServiceFeeDetail/Processed
WORKING_DIR=$EDB_DATA_PATH/ServiceFeeDetail/Working/
LOG_DIR=$EDB_LOG_PATH/ServiceFeeDetail
USER_ID=CBE_USER

EXITCODE=$EXITCODE_GEN_FAILURE

export INPUT_DIR
export WORKING_DIR
export PROCESSED_DIR
export LOG_DIR
export USER_ID

## Print all the entered Input parameters value.
echo $INPUT_DIR
echo $WORKING_DIR
echo $PROCESSED_DIR
echo $LOG_DIR
echo $USER_ID

echo $JOB_START_TIME_MSG `date +"%D_%T"`

TODAY_M_D=`TZ=PCT5EST date '+%m%d%H%M%S'`

## Move Service Fee Detail XML files to WORKING_DIR

if [ -a $INPUT_DIR/ServiceFeeDetailFeed*.xml ]; then
  for xmlFile in $INPUT_DIR
		do 
            echo "Insdie loop"
			mv $(find -regex "\./ServiceFeeDetailFeed[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\.xml") $WORKING_DIR
            echo $fileFound
			#mv $fileFound 
		done
else
		echo "No Service Fee Detail XML File to process"
fi


when i try to run the mv command is not working.

im getting the following error

Code:
/edb/dev/log/ServiceFeeDetail
CBE_USER
05/30/11_04:32:11
Insdie loop
mv: missing destination file operand after `/edb/dev/data/ServiceFeeDetail/Working/'
Try `mv --help' for more information.

If run the
Code:
$(find -regex "\./ServiceFeeDetailFeed[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\.xml")

seperately this is working fine. Please help me...


thanks
Balesh
# 2  
Old 05-30-2011
Have you check the current working directory while running your script and the command separately

The $(cmd) substitution worked fine for me with ksh..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create file Dir and Sub Dir same time

Hi Guys , I want create files Dire and Sub Dire. as same time using variable. EX: x1="/hk/Pt/put/NC/R1.txt" x2="/hk/pt/Put/Ot/NC/RN.txt" And i want delete all after done with my script. Thanks (2 Replies)
Discussion started by: pareshkp
2 Replies

2. Solaris

Problem in File/Dir sharing between a windows and solaris

Hi , We are trying to share a particular directory between solaris running from VMware installed on Win7 box] and windows box. We tried the SWAT utility of samba, and made all possible changes for sharing. We committed the changes and we were clueless what need to be done further.. referred... (0 Replies)
Discussion started by: BalajiUthira
0 Replies

3. UNIX for Dummies Questions & Answers

How to list all files in dir and sub-dir's recursively along with file size?

I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file Please help me in this regard and many thanks in advance. (3 Replies)
Discussion started by: nmakkena
3 Replies

4. Shell Programming and Scripting

moving files from a dir in one machine to a dir in another machines

Hi, I am a unix newbie.I need to write a shell script to move my oracle READ WRITE datafiles from one serevr to another. I need to move it from /u01/oradata/W1KK/.. to /u01/oradata/W2KK, /u02/oradata/W1KK/.. to /u02/oradata/W2KK. That is, I actaully am moving my datafiles from one database to... (2 Replies)
Discussion started by: mathews
2 Replies

5. UNIX for Dummies Questions & Answers

Copying dir (and sub dir) file names from ftp server to txt file in diff server

Hey all, i want to copy only the file names from an ftp server (directory and all sub directory) to a text file in another server (non ftp), i.e. i want to recursively move through directories and copy only the names to a text file. any help is appreciated...thank you in advance (1 Reply)
Discussion started by: deking
1 Replies

6. Shell Programming and Scripting

Moving file from one dir to Another with Given Qualifier

Hi, I want to Move files from one dir to another dir on same mount point. The source dir may contain subdir or files within it. Search the files or subfolder which is older then a given datetime . Move the file recursively and after each successful move of file make an entry to log... (2 Replies)
Discussion started by: rkmbcbs
2 Replies

7. Shell Programming and Scripting

moving dir subdir and files

I have created a directory structure and under the directory subdirectories and files are there.I need to move the entire thing to another path.How can i write a script to do that. currently the path of files is as below : /data1/serial/mcycle/archive : under this path differnt sub dir exist ... (6 Replies)
Discussion started by: dr46014
6 Replies

8. UNIX and Linux Applications

CPIO Problem, copy to the root dir / instead of current dir

HI all, I got a CPIO archive that contains a unix filesystem that I try to extract, but it extract to the root dir / unstead of current dir, and happily it detects my file are newer otherwise it would have overwrited my system's file! I tried all these commands cpio -i --make-directories <... (2 Replies)
Discussion started by: nekkro-kvlt
2 Replies

9. Shell Programming and Scripting

Moving file(s) from dir to dir

Hi, I am fairly new to writing scripts. I am trying to write a script that moves either One or All of the files from one directory to another. I know how to make the actual command to do it, but i don't quite know how to add operators to it, ie -i or -a. I want -i to move one file from... (4 Replies)
Discussion started by: SirJoeh
4 Replies

10. Shell Programming and Scripting

Problem while moving a file

Dear Friends, You can easily understand my problem after looking into the code. test1.sh -------- #!/bin/sh LOG_HOME="/home/vel" while do echo `date` done test2.sh -------- #!/bin/sh LOG_HOME="/home/vel" if then sh $LOG_HOME/test1.sh >> $LOG_HOME/1.log (5 Replies)
Discussion started by: smvel
5 Replies
Login or Register to Ask a Question