LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   After a piece of software/a bash script to mass-move files [Fedora Core 6] (https://www.linuxquestions.org/questions/linux-desktop-74/after-a-piece-of-software-a-bash-script-to-mass-move-files-%5Bfedora-core-6%5D-504275/)

Alux 11-23-2006 12:52 PM

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?

muha 11-23-2006 01:12 PM

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!

Alux 11-23-2006 01:16 PM

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!

muha 11-23-2006 02:33 PM

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.


All times are GMT -5. The time now is 12:26 PM.