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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To compare selective file in different folders gmahesh2k UNIX for Dummies Questions & Answers 0 05-15-2008 02:03 AM
Recursive file processing k_mufasa Filesystems, Disks and Memory 4 03-24-2008 12:35 PM
find file with date and recursive search for a text rosh0623 UNIX for Advanced & Expert Users 10 08-16-2006 02:27 PM
Selective Umask baanprog UNIX for Advanced & Expert Users 3 08-03-2006 09:48 AM
extracting recursive data file bbeugie UNIX for Dummies Questions & Answers 1 06-16-2004 05:48 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-07-2005
dinalt dinalt is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 4
Question Selective, recursive file diddling!

Hello,

I have been trying all sorts of combinations and been royally screwing up my filesystem in the process I have a bunch of .wav files in a hierarchical album/artist etc folder structure and each has a duplicate .w4a file next to it.

All I want to do is move all the .w4a files to somewhere else, complete with the hierarchical folder structure, whilst leaving the .wavs where they are. I figured the following would work at the top level of the folder structure:

mv -r *.w4a ~/blah/blah/newplace/

Obviously i need to spend less time outside and more on the command line because this doesn't work

Sing your praises, I would.

Many thanks,
L
  #2 (permalink)  
Old 04-07-2005
dangral dangral is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2002
Posts: 699
What I would do is copy the top level of the heirarchical file structure i.e.

Code:
cp -r /toplevel ~/blah/blah/newplace/

cd ~/blah/blah/newplace/

find . -type f -name "*.wav" -exec rm -f {} \;
Of course make sure you have enough room for the initial copy of all the .wav and .w4a files.

Maybe someone else has a cleaner solution?
  #3 (permalink)  
Old 04-07-2005
dinalt dinalt is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 4
Thanks for the suggestion, but I don't have the luxury of all that space.

I am trying to move just the compressed files from a large capacity external firewire drive to a laptop
  #4 (permalink)  
Old 04-07-2005
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
He said MOVE not RE-move!!! hehe...

There is no -r (recursive) option for mv that I know of... must use cp.

# This will recursively copy all the *.w4a files and directories to the new targetdir. then you must remove them... Be sure to start at the root of the filesystem. You might have to create the targetdir...

cp -r *.w4a targetdir
  #5 (permalink)  
Old 04-07-2005
dinalt dinalt is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 4
Thanks, but sadly, I've already tried this.

cp -r *.w4a ~/blah/blah/someplace/

comes back with this:

cp: *.m4a: No such file or directory

The above command will only move any .w4a files in the current directory, it does not go down recursively -
  #6 (permalink)  
Old 04-07-2005
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Try the full path instead.

or if that fails.

try cp -r . ~/to/some/dir.

Here is a good link. http://www.brandonhutchinson.com/Copy_directories.html


try this...
# cd fromdir; tar cf - . | (cd todir; tar xfp ###I think you can change the dot to *.w4a

There was a command line that I remembered using cpio that I cant remember...
  #7 (permalink)  
Old 04-07-2005
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,209
Quote:
Originally Posted by Kelam_Magnus
Try the full path instead.


There was a command line that I remembered using cpio that I cant remember...
Kelam I think this is what you meant...
Code:
find . -depth  | cpio -pdmv /path/tobe/copied/to
but combining that with -name gives

Code:
find . -depth -name "*.w4a" | cpio -pdmv /path/tobe/copied/to
and that should do what the original post asked for.
Closed Thread

Bookmarks

Tags
cpio

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:35 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