LinuxQuestions.org
Visit Jeremy's Blog.
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 07-29-2004, 01:57 PM   #1
class_struggle
Member
 
Registered: Nov 2003
Location: where rock meets hard place
Distribution: 1- Knoppix 2-Gentoo
Posts: 121

Rep: Reputation: 15
command line file management


I'm trying to get a series of jpgs scattered throughout a certain directory tree to all go into one directory or tar file.
But one basic problem I've had is that the recursive option (-R) on both ls and cp don't seem to like the wildcard. i.e. ls -R *jpg gives me an error, when it doesn't if there's no recursive option.
I'd also like to know how to list out files ina directory with the path on the left and the file name on the right. Then I could do an xargs cp with it so the whole problem could be dealt with like so:

ls -aR|grep *jpg|xargs cp --target-directory=/mytargetdir

Though it a common task, so maybe somebody has already done it.
 
Old 07-29-2004, 02:14 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Maybe something like this....

cd /home/images
find . -depth -type f -name '*.jpg' -exec cp {} /home/new_dir \;
 
Old 07-29-2004, 03:50 PM   #3
class_struggle
Member
 
Registered: Nov 2003
Location: where rock meets hard place
Distribution: 1- Knoppix 2-Gentoo
Posts: 121

Original Poster
Rep: Reputation: 15
Yes thanks, find was a good call. Experimenting at the moment, but trying to exclude certain directories. The syntax of find starts to get complicated then. that {} is also news to me.
 
  


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
Printing management (command line cups) grautu Slackware 3 10-20-2005 02:55 PM
nfs a file shares ok via file mngr but not command line. Suse 9.1 acummings Linux - Networking 2 10-09-2004 03:23 PM
Command to output file content line by line aznluvsmc Programming 2 09-12-2004 08:45 PM
Command line file manager? jleybo Linux - Software 5 02-14-2004 02:05 AM
re: how do I open file from command line ergo_sum Linux - Newbie 7 10-29-2003 12:35 PM


All times are GMT -5. The time now is 03:09 PM.

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