LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 07-27-2005, 12:19 AM   #1
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Rep: Reputation: 33
copying a range of files


I just want to copy some files, like

19814.jpg to 19850.jpg and 20015.jpg and 21115.jpg to 21210.jpg and some more file like this, I tryed to make a expression but didnt work: cp [19814-19850,20015,21115-21210].jpg /home/maginot/

I tryed cp {19814-19850,20015,21115-21210}.jpg /home/maginot/ but this dont accepct range, just singular files ...

Any ideia?

thnks!
 
Old 07-27-2005, 01:45 AM   #2
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Original Poster
Rep: Reputation: 33
the best I could do it was:

eg:
Code:
$cp file{192{3,4,5,6,7,8}{0,1,2,3,4,5,6,7,8,9},2001{0,1,2,3,4,5,6,7,8,9}}.jpg
 
Old 07-27-2005, 02:52 AM   #3
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,151

Rep: Reputation: 51
Re: copying a range of files

Quote:
Originally posted by maginotjr
I just want to copy some files, like

19814.jpg to 19850.jpg and 20015.jpg and 21115.jpg to 21210.jpg and some more file like this, I tryed to make a expression but didnt work: cp [19814-19850,20015,21115-21210].jpg /home/maginot/

I tryed cp {19814-19850,20015,21115-21210}.jpg /home/maginot/ but this dont accepct range, just singular files ...

Any ideia?

thnks!
# cp `seq 19814 19850` 20015 `seq 21115 21210`.jpg /home/maginot/

i think

edit: i were wrong. it could be:
# for i in `seq 19814 19850` 20015 `seq 21115 21210` ; do cp $i.jpg /home/maginot/; done

Last edited by whansard; 07-27-2005 at 02:59 AM.
 
Old 07-27-2005, 06:58 PM   #4
maginotjr
Member
 
Registered: Aug 2004
Location: BR - Floripa
Distribution: Ubuntu 9.10 - 2.6.x.x
Posts: 661

Original Poster
Rep: Reputation: 33
worked great, thanks!
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying files(s) in c climbingmerlin Programming 7 10-27-2005 02:00 PM
need help with copying files Earl Parker II Linux - General 8 09-12-2005 08:54 AM
Copying FIles Casper12 General 4 08-07-2005 04:30 PM
How to List files between date1 and date2 (range of time)? mystique98ls Linux - Newbie 2 09-10-2004 04:36 PM
copying files neozero62 Linux - Newbie 1 11-23-2003 05:38 PM


All times are GMT -5. The time now is 11:07 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration