redirect files to a directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting redirect files to a directory
# 1  
Old 04-04-2008
redirect files to a directory

i have some 2000 files and i want to redirect it to a dir

after i give the command

find . -mtime -15 -print

it gives some 2000 files

file1.DAT
file2.DAT
:
:
:
file2000.DAT
------------------------------------------------------------------------how to redirect all these 2000 files in a dir.

here wat im doing

find . -mtime -15 -print >> TNS_Files
--------------------------------------------------------------------

the above command giving error

Is a directory
ksh: TNS_Files: cannot create
----------------------------------------------------------
# 2  
Old 04-04-2008
exec

Code:
find . -mtime -15 -exec cp {} TNS_Files \;

# 3  
Old 04-04-2008
thanks i got it from ur help.hats off to u
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Directory containing files,Print names of the files in the directory that are exactly same content.

Given a directory containing say a few thousand files, please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents. func(a_directory_name) output -> {“matches”: , ... ]} e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

2. Shell Programming and Scripting

Cat files listed in text file and redirect to new directory with same filename

I have a directory that is restricted and I cannot just copy the files need, but I can cat them and redirect them to a new directory. The files all have the date listed in them. If I perform a long listing and grep for the date (150620) I can redirect that output to a text file. Now I need to... (5 Replies)
Discussion started by: trigger467
5 Replies

3. Shell Programming and Scripting

redirect output to a directory given as an argument

I have a ksh script thats creates a list of files as output but I want to place these generated files into a certain directory which is given as an argument, any of your kind help would be appreciated. For eg.: #./test.ksh <directory name> Thanks mbak (1 Reply)
Discussion started by: mbak
1 Replies

4. Shell Programming and Scripting

> to empty files, but ambiguous redirect

Hi Everyone, # ll total 0 -rw-r--r-- 1 root root 0 2010-05-13 11:29 a1.log -rw-r--r-- 1 root root 0 2010-05-13 11:29 a2.log -rw-r--r-- 1 root root 0 2010-05-13 11:29 a3.log # rm a.log above rm no problem, but when i use "> a.log", it says "-bash: a.log: ambiguous redirect". ... (3 Replies)
Discussion started by: jimmy_y
3 Replies

5. Shell Programming and Scripting

Redirect Output and Error in 2 different files

hi, i want to redirect my output & error if generated to two different files. I have written the code for redirecting the output, i dnt have ne idea how to go abt it for errors. I tried spooling which was given in one of the threads on this forum.But it didn't work.The script i wrote as a lot... (4 Replies)
Discussion started by: bankimmehta
4 Replies

6. Shell Programming and Scripting

How to redirect you o/p to many files at the same time.

How to redirect your o/p to many files without using for loop. For example:- 1-echo "blablabla" > out01 OUT 2-echo "blablabla" 1>out01 1>OUT 3-echo "blablabla" 1>&out01 1>&OUT the above code does not work! in "1" only the o/p goes to out01 in "2" & "3" the o/p goes to OUT ... (4 Replies)
Discussion started by: ahmad.diab
4 Replies

7. Shell Programming and Scripting

How to Pull out multiple files from DB table and redirect all those files to a differetn directory?

Hi everyone!! I have a database table, which has file_name as one of its fields. Example: File_ID File_Name Directory Size 0001 UNO_1232 /apps/opt 234 0002 UNO_1234 /apps/opt 788 0003 UNO_1235 /apps/opt 897 0004 UNO_1236 /apps/opt 568 I have to... (3 Replies)
Discussion started by: ss3944
3 Replies

8. Shell Programming and Scripting

how to redirect multiple input files?

I have a program that runs like "cat f1 - f2 -", I need to write shell script to run the program whose standard input will be redirected from 2 files. I spend a whole day on it, but didn't figure out. Can someone help me out? Thanks! (8 Replies)
Discussion started by: microstarwwx
8 Replies

9. UNIX for Dummies Questions & Answers

can you redirect multiple files for input?

I have a program that is reading strings into a vector from a file. Currently I am using this command: a.out < file1 The program runs and prints the contents of the vector to the screen, like its supposed to. The problem is that it needs to read in 3 files to fill the vector. Is there anyway... (4 Replies)
Discussion started by: Matrix_Prime
4 Replies

10. UNIX for Dummies Questions & Answers

Redirect output to multiple files.

Hi, I am new to shell scripting and have a question. I would like to redirect the output of a command to multiple files, each file holding the exact same copy. From what I read from the bash manpage and from some searching it seems it cannot be done within the shell except setting up a loop. Is... (3 Replies)
Discussion started by: cbkihong
3 Replies
Login or Register to Ask a Question