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
DB5.1_HOTBACKUP(1)					      General Commands Manual						DB5.1_HOTBACKUP(1)

NAME
db5.1_hotbackup - Create "hot backup" or "hot failover" snapshots SYNOPSIS
db5.1_hotbackup [-cDuVv] [-d data_dir ...] [-h home] [-l log_dir] [-P password] -b backup_dir DESCRIPTION
The db5.1_hotbackup utility creates "hot backup" or "hot failover" snapshots of Berkeley DB database environments. The db5.1_hotbackup utility performs the following steps: 1. If the -c option is specified, checkpoint the source home database environment, and remove any unnecessary log files. 2. If the target directory for the backup does not exist, it is created with mode read-write-execute for the owner. If the target directory for the backup does exist and the -u option was specified, all log files in the target directory are removed; if the -u option was not specified, all files in the target directory are removed. 3. If the -u option was not specified, copy application-specific files found in the database environment home directory, or any directory specified using the -d option, into the target directory for the backup. 4. Copy all log files found in the directory specified by the -l option (or in the database environment home directory, if no -l option was specified), into the target directory for the backup. 5. Perform catastrophic recovery on the hot backup. 6. Remove any unnecessary log files from the hot backup. The db5.1_hotbackup utility does not resolve pending transactions that are in the prepared state. Applications that use DB_TXN->prepare should specify DB_RECOVER_FATAL when opening the environment, and run DB_ENV->txn_recover to resolve any pending transactions, when failing over to the hot backup. OPTIONS
-b Specify the target directory for the backup. -c Before performing the snapshot, checkpoint the source database environment and remove any log files that are no longer required in that environment. To avoid making catastrophic failure impossible, log file removal must be integrated with log file archival. -d Specify one or more source directories that contain databases; if none is specified, the database environment home directory will be searched for database files. As database files are copied into a single backup directory, files named the same, stored in different source directories, could overwrite each other when copied into the backup directory. -h Specify the source directory for the backup, that is, the database environment home directory. -l Specify a source directory that contains log files; if none is specified, the database environment home directory will be searched for log files. -P Specify an environment password. Although Berkeley DB utilities overwrite password strings as soon as possible, be aware there may be a window of vulnerability on systems where unprivileged users can see command-line arguments or where utilities are not able to overwrite the memory containing the command-line arguments. -u Update a pre-existing hot backup snapshot by copying in new log files. If the -u option is specified, no databases will be copied into the target directory. -V Write the library version number to the standard output, and exit. -v Run in verbose mode, listing operations as they are done. -D Use the data directories listed in the DB_CONFIG configuration file in the source directory. This option has three effects: First, if they do not already exist, the specified data directories will be created relative to the target directory (with mode read-write- execute owner). Second, all files in the source data directories will be copied to the target data directories. If the DB_CONFIG file specifies one or more absolute pathnames, files in those source directories will be copied to the top-level target directory. Third, the DB_CONFIG configuration file will be copied from the +source directory to the target directory, and subsequently used for configuration if recovery is run in the target directory. Care should be taken with the -D option and data directories which are named relative to the source directory but are not subdirectories (that is, the name includes the element "..") Specifically, the constructed target directory names must be meaningful and distinct from the source directory names, otherwise running recovery in the target directory might corrupt the source data files. It is an error to use absolute pathnames for data directories or the log directory in this mode, as the DB_CONFIG configuration file copied into the target directory would then point at the source directories and running recovery would corrupt the source data files. The db5.1_hotbackup utility uses a Berkeley DB environment (as described for the -h option, the environment variable DB_HOME, or because the utility was run in a directory containing a Berkeley DB environment). In order to avoid environment corruption when using a Berkeley DB environment, db5.1_hotbackup should always be given the chance to detach from the environment and exit gracefully. To cause db5.1_hot- backup to release all environment resources and exit cleanly, send it an interrupt signal (SIGINT). The db5.1_hotbackup utility exits 0 on success, and >0 if an error occurs. ENVIRONMENT
DB_HOME If the -h option is not specified and the environment variable DB_HOME is set, it is used as the path of the database home, as described in DB_ENV->open. AUTHORS
Oracle Corporation. This manual page was created based on the HTML documentation for db_hotbackup from Sleepycat, by Thijs Kinkhorst <thijs@kinkhorst.com>, for the Debian system (but may be used by others). 28 January 2005 DB5.1_HOTBACKUP(1)
All times are GMT -4. The time now is 10:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy