Hi,
I am trying to copy a file to "B" directory also once it is done, i am trying to move the files to "C" directory.
And have written the below code to do so.
The code works fine, but sometimes i am seeing the file count mismatch from b directory to c directory.
I have enabled the code in cronjob to carry out the process once in every hour as file count will be huge.
Need suggestion on below points
1. How can i add the logs to identify the problem.
2. And what might be the problem where it is not able to move all the files to new directory after the copy.
#SD=source dir TD= target dir
SD="$/amddev/app01/manoj/new/scripts/old"
TD="$/amddev/app01/manoj/new/scripts/new"
EXT="$*.txt"
for i in `ls -F "$SD"/*"$EXT"|grep -v /$` do
mv "$SD" "$TD"
if
then
echo "$i" successfully moved
echo Manoj successfully..1 ( here i... (8 Replies)
hi ..
I have automate some process on unix through sehll script .
but i don't know there is some problem in scripts, some time shell script works and some time it fails. so my query is that "Why shell script fails some times?"
thanks (4 Replies)
hi ,
i m trying to run a shell script automatically , some time it works fine but some time it fails , what could be the problem .
If anybody have an idea about this problem then reply .
Thanks in advacne (4 Replies)
Hi ,
I need a shell script which basicaly moves all the files from one folder say folder x to folder y and once they are moved to folder y a datetimestamp should be attached to there name
for ex
file a should be moved to y folder and renamed as a_20081015 (1 Reply)
Hi Experts,
I have a "Source" folder which may contain some files. I need a shell script which should move all files which are older than 3 days to "Archive" folder.
Thanks in Advance... (4 Replies)
All,
I executing a perl script and shell script from a master shell script. i will execute the perl script first and have to execute the shell script after the completion of perl execution. Below is the code i use for it,
script_root='/dev/scripts'
/usr/bin/perl -S $script_root/test.pl;... (5 Replies)
Hey guys,
ive been working on this for about 2hrs now - without any solution.
At first I need to say I dont have skills in linux bash scripting, but I tried to use some codesnippets and manuals from google.
What I want to do:
I have different folders including 2 different filestypes with... (15 Replies)
Hi,
i am new here let me say HI for all.
now i have a question please:
i am sending one command to my machine to create 3 names.
if one of the names exists then the box return error message that already have the name but will continue to create the rests.
How i can break the command and... (7 Replies)
Array declared in shell script works for AiX 6.1 and above but fails in Linux CentOS 7.
I have the below code for Array in my shell script that runs fine on AiX systems.
Note: on AiX it uses ksh shell while on Linux it uses non ksh shell.
set -A filelist
However, i now wish to use the... (3 Replies)
Discussion started by: mohtashims
3 Replies
LEARN ABOUT NETBSD
mv
MV(1) BSD General Commands Manual MV(1)NAME
mv -- move files
SYNOPSIS
mv [-fiv] source target
mv [-fiv] source ... directory
DESCRIPTION
In its first form, the mv utility renames the file named by the source operand to the destination path named by the target operand. This
form is assumed when the last operand does not name an already existing directory.
In its second form, mv moves each file named by a source operand to a destination file in the existing directory named by the directory oper-
and. The destination path for each operand is the pathname produced by the concatenation of the last operand, a slash, and the final path-
name component of the named file.
The following options are available:
-f Do not prompt for confirmation before overwriting the destination path.
-i Causes mv to write a prompt to standard error before moving a file that would overwrite an existing file. If the response from the
standard input begins with the character ``y'', the move is attempted.
-v Cause mv to be verbose, showing files as they are processed.
The last of any -f or -i options is the one which affects mv's behavior.
It is an error for any of the source operands to specify a nonexistent file or directory.
It is an error for the source operand to specify a directory if the target exists and is not a directory.
If the destination path does not have a mode which permits writing, mv prompts the user for confirmation as specified for the -i option.
Should the rename(2) call fail because source and target are on different file systems, mv will remove the destination file, copy the source
file to the destination, and then remove the source. The effect is roughly equivalent to:
rm -f destination_path &&
cp -PRp source_file destination_path &&
rm -rf source_file
EXIT STATUS
The mv utility exits 0 on success, and >0 if an error occurs.
SEE ALSO cp(1), rename(2), symlink(7)STANDARDS
The mv utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.
The -v option is an extension to IEEE Std 1003.2 (``POSIX.2'').
BSD December 26, 2002 BSD