Sponsored Content
Top Forums Shell Programming and Scripting find and copy file to another directory.. Post 302370472 by Reddy482 on Wednesday 11th of November 2009 01:39:53 PM
Old 11-11-2009
find and copy file to another directory..

Hi Everybody,

i want a samll help to write a script.
i had source location with :/user/bin (bin contains subdirectories with like names emails etc and had several files in each subdirectory)

and target location with :/usr/scripts (having same subdirectories names and had some files)

Now i have to write a script that copies the files in to the source subdirectory to target directory by putting a timestamp infront of the file name (like 20081022_saomename.txt) .

If i passed the directory name as argument to the script it should search in the respective directory and copy files from source to the respective target direcoty with timestamp file name.
otherwise if called the script it must copy all the subdirectories and files to target Location.

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find files and copy into a directory

hi all, can u please help me in finding all ksh file in directory and including all subdirectories and then copy those files into another directory. thanks in advance -bali (4 Replies)
Discussion started by: balireddy_77
4 Replies

2. UNIX for Dummies Questions & Answers

copy file to a directory by sequence

Hi I am new in unix and look for help in urgent. I have a list of data files that located in a directory, and need to copy to another directory for loading. The condition here is, the list of data files has to be copy over by sequence, and if there is no file in targetted directory already. ... (4 Replies)
Discussion started by: fooky
4 Replies

3. Shell Programming and Scripting

shell script to find and copy the files creted in the year 2006 to another directory

Hi All, I am new to UNIX. I will be thankful if some one helps me. I have to write a shell script for one of the requirement. I have files created from Jan 2006 to March 2008. My requirement is to write a script in such a way that 1) To find and copy(not Moving) the files created in the... (2 Replies)
Discussion started by: manas6
2 Replies

4. UNIX for Dummies Questions & Answers

Find & Copy Selected files to another Directory

I am wanting to find files within a directory that are over a certain number of days old and copy them to another directory. And unfortunately not having much luck.......is someone able to help. Would also like to add that there are literally thousands of files that I am wanting to copy in one... (3 Replies)
Discussion started by: hellfyre
3 Replies

5. UNIX for Dummies Questions & Answers

How to find and copy files from one directory to another

Ok i have three directories Destination - /u/dir1 (has subdirectories dir2 which also has subdirectory dir3) Source1 - /u/test/files/dir1/dir2/dir3 Source2 - /u/out/images/dir1/dir2/dir3 What i would like to do is copy everything from Source1 and Source2 into the Destination directory.... (3 Replies)
Discussion started by: ziggy25
3 Replies

6. UNIX for Dummies Questions & Answers

How to copy a file to a directory?

Hello all, I've been researching this problem for days, and have gotten no luck . =/ How do you copy a file to another directory without being in the same directory as the file? So, for example, say I wanted to copy the file 'my.txt' that is in the directory ' /export/hom0/user/asdf ' to the... (9 Replies)
Discussion started by: kvnqiu
9 Replies

7. Programming

how to copy file to a directory

Hello, I've been spending a lot of hours trying to imitate cp copying a file to a directory. cp I just can't seem to write to a specified directory, it only creates a copy on the current directory. any hints/tips will help! Thanks! here's the code i've been trying to manipulate: ... (1 Reply)
Discussion started by: l flipboi l
1 Replies

8. Shell Programming and Scripting

how to copy the directory but not copy certain file

Hi experts cp bin root src /mnt but not copy bin/bigfile any help? ( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum) Thanks (6 Replies)
Discussion started by: yanglei_fage
6 Replies

9. Shell Programming and Scripting

Find and copy these files to particular directory

RedHat Enterprise Linux 5.4 I have some files with the extension .cdp in several directories in various mountpoints(filesystems) . I would like to find and copy all these files into a single directory /u03/diagnore/data. How can I do this ? (3 Replies)
Discussion started by: kraljic
3 Replies

10. UNIX for Dummies Questions & Answers

Find most recent file and copy to another directory.

Very new to shell scripting. Not sure if my title is correct but I will try and explain. Directory has 100+ files with this format, " ABCD_ABC_Abc_AB0126.abc ". When a new file gets created, the 16-19 characters in the file name gets incremented by 1. Ex...todays most recent file is... (14 Replies)
Discussion started by: askvip
14 Replies
AFS-UP(1)						       AFS Command Reference							 AFS-UP(1)

NAME
up - Recursively copy directories, preserving AFS metadata SYNOPSIS
up [-v] [-1] [-f] [-r] [-x] [-m] <source directory> <destination directory> DESCRIPTION
The up command recursively copies the files and subdirectories in a specified source directory to a specified destination directory. The command interpreter changes the destination directory and the files and subdirectories in it in the following ways: o It copies the source directory's access control list (ACL) to the destination directory and its subdirectories, overwriting any existing ACLs. o If the issuer is logged on as the local superuser root and has AFS tokens as a member of the group system:administrators, then the source directory's owner (as reported by the "ls -ld" command) becomes the owner of the destination directory and all files and subdirectories in it. Otherwise, the issuer's user name is recorded as the owner. o If a file or directory exists in both the source and destination directories, the source version overwrites the destination version. The overwrite operation fails if the first (user) "w" (write) mode bit is turned off on the version in the destination directory, unless the -f flag is provided. o The modification timestamp on a file (as displayed by the "ls -l" command) in the source directory overwrites the timestamp on a file of the same name in the destination directory, but the timestamp on an existing subdirectory in the destination directory remains unchanged. If the command creates a new subdirectory in the destination directory, the new subdirectory's timestamp is set to the time of the copy operation, rather than to the timestamp that the subdirectory has in the source directory. The up command is idempotent, meaning that if its execution is interrupted by a network, server machine, or process outage, then a subsequent reissue of the same command continues from the interruption point, rather than starting over at the beginning. This saves time and reduces network traffic in comparison to the UNIX commands that provide similar functionality. The up command returns a status code of 0 (zero) only if it succeeds. Otherwise, it returns a status code of 1 (one). This command does not use the syntax conventions of the AFS command suites. Provide the command name and all option names in full. OPTIONS
-v Prints a detailed trace to the standard output stream as the command runs. -1 Copies only the files in the top level source directory to the destination directory, rather than copying recursively through subdirectories. The source directory's ACL still overwrites the destination directory's. (This is the number one, not the letter "l".) -f Overwrites existing directories, subdirectories, and files even if the first (user) "w" (write) mode bit is turned off on the version in the destination directory. -m Recognize and copy mount points rather than traversing the volumes they reference during the recursive copy operation. Without -m, up's default behavior is to copy the contents of all volumes and subvolumes mounted under the source directory into the volume containing the destination directory. -r Creates a backup copy of all files overwritten in the destination directory and its subdirectories, by adding a ".old" extension to each filename. -x Sets the modification timestamp on each file to the time of the copying operation. source directory Names the directory to copy recursively. destination directory Names the directory to which to copy. It does not have to exist already. EXAMPLES
The following command copies the contents of the directory dir1 to directory dir2: % up dir1 dir2 PRIVILEGE REQUIRED
The issuer must have the "a" (administer) permission on the ACL of both the source and destination directories. COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 AFS-UP(1)
All times are GMT -4. The time now is 10:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy