Help with copying the list of files from one location to other location


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with copying the list of files from one location to other location
# 1  
Old 06-09-2013
Help with copying the list of files from one location to other location

A) I would like to achive following actions using shell script. can someone help me with writing the shell script

1) Go to some dir ( say /xyz/logs ) and then perform find operation in this dir and list of subdir using
Code:
find . -name "*" -print | xargs grep -li 1367A49001CP0162 > /tmp/nbkzkvc0xs/tracefile

Pls note that "1367A49001CP0162" this will be the command line argument/parameter to be used while running the script
2) Then, I need to copy all the files present in "/tmp/nbkzkvc0xs/tracefile" file to some /tmp/Girish location
3) Once all the files are copied in /tmp/Girish location, i need to zip them in trace.zip file and then send this zip file on to my email id say xyz@gmail.com

Thanks,
GKG

---------- Post updated at 07:04 AM ---------- Previous update was at 05:52 AM ----------

B) Pls help me to write a shell script.
I have to to run mutiple SQL and store their result in excel file at some/tmp location.

Pls help how can I achieve the following things :
1) DB connection in shell script
2) once connection is made, how to run the sql inside shell script
eg: select * fromfile_table where file_id like'%9184H70140%';

Pls note that "9184H70140" this will be the command line argument/parameter to be used while running the script

3) store the result of above select SQL in the .csv or .xls file and then copy that file to /tmp location

Last edited by joeyg; 06-10-2013 at 04:12 PM.. Reason: next time please use code tags for your code and data
# 2  
Old 06-10-2013
These are two independent questions in one thread. Please split them up into two threads.

On your items A 1) & 2), why don't you try sth like
Code:
find . -iname "*1367A49001CP0162*" -exec cp {} /tmp/Girish +

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying the files in to multiple location using shell script

Hi All, i'm trying to copy the 1.txt files (sample files) in to different path location using the below command. But it is not copying the files , when i tried for single location able to copy the file. can any one please assist here. Please find the below path :- /ckr_mkr1/licencekey... (2 Replies)
Discussion started by: venkat918
2 Replies

2. UNIX for Beginners Questions & Answers

List all files and copying to different location

Hello All, I want to copy all files from the list below to a path /qa0/repo/AS/CPY (lnx17:qa0:/qa0/repo/AS>) ls -lrt | grep 'Feb 14' -rw-rw-r-- 1 Ks1 qa0 39 Feb 14 20:11 HHH.dat -rw-rw-r-- 1 Ks1 qa0 32 Feb 14 20:11 HHH1.dat -rw-rw-r-- 1 Ks1 qa0 29 Feb 14 20:11... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

3. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

Hi, I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location. Ex: mainfolder1 file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure. rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies

4. Shell Programming and Scripting

Copying files from windows shared location to linux box

Hi, i am new to shell scripting. i have a requirement to copy the files from a windows shared location( vendor will place the files here) to Linux server( my Informatica will pick the files from this location). Files should be loaded in the order in which they were placed in windows box.(Based on... (1 Reply)
Discussion started by: Haari
1 Replies

5. Solaris

list of files in a txt file from sftp location

I want equivalent of ftp in sftp for listing of files into local machine from sftp location. ftp>ls -l list.txt the above creates a file list.txt in the local machine's current directory. sftp>ls -l list.txt it is giving Couldn't stat remote file: No such file or directory is there... (1 Reply)
Discussion started by: megh
1 Replies

6. Shell Programming and Scripting

Help on Moving files from one location to another location

Hi, I am new to unix and shell scripting. Please help me in resolving the below issue. In my shell script I have a variable which stores the different files with the path. Now I need to move all the files one by one to another location. ---- 1.... (4 Replies)
Discussion started by: kpagadala
4 Replies

7. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

8. Shell Programming and Scripting

Transfer files from one location to another location

Hi, i have to transfer of files of User1 located in Location1 to user2 located in Location2 using shell script. Please suggest me. (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

9. UNIX for Advanced & Expert Users

copy files from one location to similar location

I need help in forming a script to copy files from one location which has a sub directory structure to another location with similar sub directory structure, say location 1, /home/rick/tmp_files/1-12/00-25/ here 1-12 are the number of sub directories under tmp_files and 00-25 are sub... (1 Reply)
Discussion started by: pharos467
1 Replies

10. UNIX for Dummies Questions & Answers

copying files from one location to another based on a list

I have a text list of about 3,000 file names (image files), which exist on a server and that I want to copy over to another location. I understand the Unix cp code, but what's the string to have it copy multiple files based on an external list? Many thanks! (4 Replies)
Discussion started by: rebornhonest
4 Replies
Login or Register to Ask a Question