LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-11-2010, 07:45 AM   #1
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Rep: Reputation: 16
There is any way to copy with -p option all *.v files?


Hi...


how can i copy by script or command files with *.v suffix by "-p" option ?

Example:

kuku.ggg
kuku.dd
kuku.v
kuku.vb

only if i try to copy kuku.v by default cp -p will done.
 
Old 04-11-2010, 08:06 AM   #2
LouRobytes
Member
 
Registered: Mar 2010
Location: Nova Scotia, Canada
Distribution: Ubuntu & Fedora
Posts: 189

Rep: Reputation: 44
Code:
cp -p path/ *.v
Substitute path with location.

Works for me.

Cheers, Lou
 
Old 04-11-2010, 08:12 AM   #3
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by LouRobytes View Post
Code:
cp -p path/ *.v
Substitute path with location.

Works for me.

Cheers, Lou
sorry i have a missing details.

i want allways use "cp file location"
but if file cotain *.v...

cp file location = cp -p file location.

Thanks
 
Old 04-11-2010, 08:42 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Are you saying that you want to use the -p flag only if the file contains ".v" extension?

How about this:
Code:
find <path> -name "*.v" -exec cp -p {} newname \;
 
Old 04-11-2010, 09:21 AM   #5
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by pixellany View Post
Are you saying that you want to use the -p flag only if the file contains ".v" extension?

How about this:
Code:
find <path> -name "*.v" -exec cp -p {} newname \;
seems o.k but how can i set that if it doesn't equal to *.v that use cp without "-p" option?

Thnak
 
Old 04-11-2010, 09:30 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Code:
for filename in $(ls -lR); do
     if [ <test for .v> ]; then cp -p <details>
     else cp <details>
     fi
done
Insert the appropriate code inside the <...>
 
Old 04-11-2010, 09:33 AM   #7
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by pixellany View Post
Code:
for filename in $(ls -lR); do
     if [ <test for .v> ]; then cp -p <details>
     else cp <details>
     fi
done
Insert the appropriate code inside the <...>
I'm using cshell.
could you write it on cshell?

sorry if its bother you.
 
Old 04-11-2010, 10:34 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by DoME69 View Post
I'm using cshell.
could you write it on cshell?

sorry if its bother you.
I was only trying to show the approach---basically to look at one file at time, determine if it has the .v extension, and then take the desired action.

I'm sure that "cshell" has similar syntax--check your documentation.

Last edited by pixellany; 04-11-2010 at 06:11 PM. Reason: typo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to enable copy paste option between Vista (host) and Fedora (Guest) on VMware Maggidis Linux - Virtualization and Cloud 1 02-28-2010 09:17 AM
Creating a script to move or copy files into multiple directories below the files matthes138 Linux - Newbie 5 08-25-2009 04:57 PM
cp (copy) option gautam143 Linux - Software 4 07-30-2008 08:44 AM
in copy files or ls files the command want to invert select some files how to?? hocheetiong Linux - Newbie 3 06-27-2008 06:32 AM
Command to copy files/folders but skip bad/corrupt files?? leemoreau Linux - Newbie 2 04-02-2007 02:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration