LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 11-23-2006, 12:52 PM   #1
Alux
LQ Newbie
 
Registered: Nov 2006
Posts: 6

Rep: Reputation: 0
After a piece of software/a bash script to mass-move files [Fedora Core 6]


Basically I have a folder with many sub folders, each containing one more sub folder and a file within that. What I need is for it to go into each of thse sub-sub folders, get the file and movie it somewhere else.

Anyone know an easy way?
 
Old 11-23-2006, 01:12 PM   #2
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
something like this will work for all files named .txt:
Code:
find . -name *.txt| xargs mv {} ./all_files_go_here \;
or to move all files:
Code:
find . -type f -exec mv {} ./all_files_go_here \;
I can't check the syntax since i'm not on my machine atm, might contain typos!
 
Old 11-23-2006, 01:16 PM   #3
Alux
LQ Newbie
 
Registered: Nov 2006
Posts: 6

Original Poster
Rep: Reputation: 0
I'm getting an errorrr..

Quote:
mv: target `./676673/203711296/Home_Movies_-_302_-_Breaking_Up_Is_Hard_To_Do.part1.rar' is not a directory
Script is:
Quote:
find . -name *.rar| xargs mv {} "/root/Downloads/RARs/" \;
edit:

Other one worked, thanks a bunch!

Last edited by Alux; 11-23-2006 at 01:18 PM.
 
Old 11-23-2006, 02:33 PM   #4
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
Ah, with xargs this would work:
Code:
find . -name *.txt |xargs mv --target-directory=./some_dir
Find all files *.txt recursively and mv them to some_dir.
 
  


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 tell bash to move files to another folder? hq4ever Linux - Newbie 10 12-30-2010 03:15 AM
Unusual piece of bash script code raypen Slackware 2 03-18-2006 10:49 PM
BASH USAGE: mass files rename sirpelidor Linux - General 8 09-20-2005 12:36 AM
usb mass storage input/output error on fedora core 2 friendship7 Linux - Hardware 2 01-02-2005 04:18 PM
Script to Move files jain_rajesh Linux - Newbie 1 10-15-2004 08:53 AM


All times are GMT -5. The time now is 12:09 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 Google+: linuxquestions
Open Source Consulting | Domain Registration