Moving multiple files
I've enountered this situation on multiple systems....
On a particular server there are image files strung about the webroot directory structure....example /wwwroot/605/cf/fblahblah/images/OLD_fiserwringn616.jpg /wwwroot/205/gnd/blahhdf/image1/dr3/ghhd/OLD_blhja43newone.gif /wwwroot/sd/234/45554/sdfgsdfsg/whatever/whateverelse/in/more/directories/forever/OLD_2335435.jpg all the image files are in the OLD_*.extension naming scheme. I'm needing to move ALL 600+ like this to one backup directory. I have considered several ways of doing this, but Im under HUGE time constraints. I was wondering if anyone had done this before and if they could offer advice or script concepts for it. Please help me. I'm under a lot of pressure. |
Do you need to maintain the directory structure?
Assuming they are all different names: find /wwwroot -name "OLD_*" -exec mv {} /path/to/backup/ \; |
SOLUTION!!!
xargs....I must remember this.
For a linux system...this is the command string I passed: find /home/joe -name "*.exe" | xargs -i mv {} exe/directoryforallexes/ For a Solaris system....this is the command string I passed: find /wwwroot/allthestuff -name "*OLD_*.*" | xargs -I {} -t mv {} /wwwroot/oldstuffonly/ solaris has a slighty different way of requesting the output AND how you tell the shell what you're trying to do, but I figured it out in minutes instead of hours. credit goes to chort(I believe) from the Linux Enterprise forum and O'REILLY for great books on nix!!!! |
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.
http://www.linuxquestions.org/rules.php http://www.linuxquestions.org/questi...hreadid=226263 |
All times are GMT -5. The time now is 10:59 PM. |