How to copy all the contents of a list of files present in a folder to a particular file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to copy all the contents of a list of files present in a folder to a particular file?
# 1  
Old 03-04-2013
How to copy all the contents of a list of files present in a folder to a particular file?

Hi All,

I want to copy all the contents of a list of files in a folder to a particular file. i am using following command:
Code:
cat dir/* >> newFile.txt

It's not working.

Could you please help?

Thanks,
Pranav
# 2  
Old 03-04-2013
Now it would try to attempt to cat dir/newFile.txt as well..

I guess this would be solved if you are having that newFile.txt in some other directory Smilie
This User Gave Thanks to PikK45 For This Post:
# 3  
Old 03-04-2013
I have placed the newFile in a different directory.
# 4  
Old 03-04-2013
is it working now???

btw, your command now have to be cat dir/* >> somedir/newFile.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unable to list folder contents

I'm unable to list the contents of a directory once I move into it. I have full permissions on this directory (called "Scripts" in the below example). The scenario is shown below in detail: Command 'ls' works fine to begin with: 1: pmn@linuxhost /home/pmn > cd /opt/smt/proiv 2:... (4 Replies)
Discussion started by: pmn
4 Replies

2. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

3. Shell Programming and Scripting

Need Script to copy the contents of two files into one file

Hi i need Script to copy the contents of two files into one file i have 2 fil X1.txt / X2.txt i need script to copy the contents of X1 and X2 In AllXfile X1.txt File X1 X2.txt File X2 AllXfile.txt File X1 File X2 (2 Replies)
Discussion started by: azzeddine2005
2 Replies

4. Shell Programming and Scripting

copy folder and its contents to another folder

Hi experts, I am coming to you with this basic question on copying a folder and its content from one location to another folder using PERL script. This is my requirement. I have a folder AB under /users/myhome I want to copy AB and its contents to /user/workspace. Finally it should... (1 Reply)
Discussion started by: amvarma77
1 Replies

5. UNIX for Dummies Questions & Answers

Replacing a particular string in all files in folder and file contents

I need to replace all filesnames in a folder as well as its content from AK6 to AK11. Eg Folder has files AK6-Create.xml, AK6-system.py etc.. the files names as well as contents should be changes to AK9-Create.xml, AK9-system.py etc All files are xml and python scripts. ---------- Post... (0 Replies)
Discussion started by: Candid247
0 Replies

6. UNIX for Dummies Questions & Answers

copy files grabbing destination folder from file name

Hi all... Below is what I am trying to do: 1. Having the following folder with the files... /source_folder/dodiddone.tar.gz /source_folder/gowentgone.tar.gz /source_folder/gowentgone.log 2. I need to copy and chown files with extension .tar.gz to another folder copy... (1 Reply)
Discussion started by: pedroz
1 Replies

7. Shell Programming and Scripting

Script to list files not present in audio.txt file

I am having following folder structure. /root/audios/pop /root/audios/jazz /root/audios/rock Inside those pop, jazz, rock folders there are following files, p1.ul, p2.ul, p3.ul, j1.ul, j2.ul, j3.ul, r1.ul, r2.ul, r3.ul And I have a file named as "audio.txt" in the path /root/audios,... (11 Replies)
Discussion started by: gopikrish81
11 Replies

8. UNIX and Linux Applications

Copy folder and its contents from HP Unix server to RH Linux

I am trying to copy a folder and all its contents from HP Unix box to RH linux, using the following. rsync -avz -e "ssh" /users/www/webroot/docFiles/Division/Ctry ftpuser@10.4.xxx.yz:/data/webroot/development/contentfiles/webroot/docFiles/Division/Ctry/QAfiles And it throws a consistent... (2 Replies)
Discussion started by: FanTom
2 Replies

9. Shell Programming and Scripting

ls > file - Creating file containing the list of all files present in a directory

Hi All, I need to create a file which contains the list of all the files present in that directory. e.g., ls /export/home/user/*.dat > list_file.dat but what i am getting is: $ ls /export/home/user/*.dat > list_file.dat /export/home/user/*.dat: No such file or directory But I have... (1 Reply)
Discussion started by: pranavagarwal
1 Replies

10. UNIX for Dummies Questions & Answers

copy folder contents

I need to make a new dir in side the dir lab5 the new dir is called testLab5 without changing directories copy all files from your lab5 directory into your testLab5 directory then i have to without chaning directories and using exactly one command remove all files that start with the... (1 Reply)
Discussion started by: robsk8_99
1 Replies
Login or Register to Ask a Question