10-08-2009
let me explain the exact requirement...
source : /data1/serial/mcycle/archive : under archive there are many directories and sub directories...but unfortunately archive dir is created in one user(say X) and rest are under other user(say Y).
Now we need to change the owner of archive to Y as X id will be removed.So i was thinking of taking a backup and moving files again...
Please suggest ..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
2. Shell Programming and Scripting
Hello, I have a directory www with multiple directories. Every directory has site name with .htm, .html, .php files or sub directories with .htm, .php, .html file as example
- www
- sitename 1
- site 1
- sitename 2
- sitename 3
What I'm looking for is a... (7 Replies)
Discussion started by: andyjill
7 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
Hi,
I want to run git status for the dir which has subdir ".git" in it with dir path mentioned in output log?
If a dir does not have .git subdir then skip that dir.
Dir will have 100 main dirs & 500 + subdirs and so on.
I appreciate all your help :b: (4 Replies)
Discussion started by: dragon.1431
4 Replies
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
Hi frnds
The following is the code
#!/bin/ksh
##############################################################
# #
# Created by eDB Dev - 27-May-2011 #
# ... (1 Reply)
Discussion started by: balesh
1 Replies
7. Shell Programming and Scripting
Hey,
How can I copy files from subdirectories without copy the subdir
and copy it to a higher dir
For example:
/home/test/subdir/file1
copy file1 to /home or another dir
thanx (11 Replies)
Discussion started by: Eclecticaa
11 Replies
8. Shell Programming and Scripting
HI,
I need to move all files from a dir & its all subdir to Archive folder which is indise dir only. and moved filename should changed to complete path ( Like Dir_subdir_subdir2_.._filename ). also all files names shoud capture in a file in order to mail
I written below code ... (11 Replies)
Discussion started by: minijain7
11 Replies
9. UNIX for Dummies Questions & Answers
Hi All,
I want to copy the dir/subdir structure from SERVER-A to SERVER-B without copying all the files in each dir.
Is it possible using SCP / SFTP command?
For example,
SERVER-A has following two dir/subdirectories and files under each subdir.
... (1 Reply)
Discussion started by: Hangman2
1 Replies
10. UNIX for Dummies Questions & Answers
How do I create a tar file for only dir and its subdir structures?? (4 Replies)
Discussion started by: vx04
4 Replies
MV(1) BSD General Commands Manual MV(1)
NAME
mv -- move files
SYNOPSIS
mv [-f | -i | -n] [-hv] source target
mv [-f | -i | -n] [-v] 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. (The -f option overrides any previous -i or -n options.)
-h If the target operand is a symbolic link to a directory, do not follow it. This causes the mv utility to rename the file source to
the destination path target rather than moving source into the directory referenced by target.
-i Cause 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' or 'Y', the move is attempted. (The -i option overrides any previous -f or -n options.)
-n Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.)
-v Cause mv to be verbose, showing files after they are moved.
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.
As the rename(2) call does not work across file systems, mv uses cp(1) and rm(1) to accomplish the move. The effect is equivalent to:
rm -f destination_path &&
cp -pRP source_file destination &&
rm -rf source_file
EXIT STATUS
The mv utility exits 0 on success, and >0 if an error occurs.
EXAMPLES
Rename file foo to bar, overwriting bar if it already exists:
$ mv -f foo bar
COMPATIBILITY
The -h, -n, and -v options are non-standard and their use in scripts is not recommended.
SEE ALSO
cp(1), rm(1), symlink(7)
STANDARDS
The mv utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.
HISTORY
A mv command appeared in Version 1 AT&T UNIX.
BSD
March 15, 2013 BSD