The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copying files from one directory into another. Krush187 Shell Programming and Scripting 4 04-07-2009 10:32 AM
Synchronization in copying multiple files to a directory amio Shell Programming and Scripting 1 03-12-2009 08:32 AM
Help with cron: copying all files in a directory to another... ashleyquick UNIX for Dummies Questions & Answers 1 12-10-2008 07:31 PM
Using cp -r command to selectively omit *.dat files while copying a directory. d_sai_kumar UNIX for Dummies Questions & Answers 5 07-18-2008 06:48 AM
Copying files from one directory to Other satishkeshetty UNIX for Dummies Questions & Answers 3 04-14-2008 08:08 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-23-2009
#moveon #moveon is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 40
Copying files to a directory

Hi I have a few questions. I am trying to copy a file to a directory. I need to copy files that do not end in numbers, for example, into a directory. This is what I tried so far. cp filename[!1-9] directorytowhereIwannacopy but it says it can't copy to a directory. I need to copy many files into one directory.

My other question is how do you get back to the directory you changed from? You changed into a directory but how do you go back from it? Finally, is there a way you can write a string into many files using just one single command?

Thanks in advance.
  #2 (permalink)  
Old 04-23-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
Quote:
Originally Posted by #moveon View Post
Hi I have a few questions. I am trying to copy a file to a directory. I need to copy files that do not end in numbers, for example, into a directory. This is what I tried so far. cp filename[!1-9] directorytowhereIwannacopy but it says it can't copy to a directory. I need to copy many files into one directory.
One way:

Code:
ls -l|awk '/^-/ && !/[0-9]$/{system("cp "$8" /dest/dir")}'
Quote:
Originally Posted by #moveon View Post

My other question is how do you get back to the directory you changed from? You changed into a directory but how do you go back from it? Finally, is there a way you can write a string into many files using just one single command?

Thanks in advance.
Code:
cd -
Clarify your 3th question.

Regards
  #3 (permalink)  
Old 04-23-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,839
Homework?

For the first, look into character classes and how to invert them.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0