Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


Closed Thread
  Search this Thread
Old 09-03-2004, 03:45 PM   #1
LQ Newbie
Registered: Aug 2004
Location: Duluth, MN
Distribution: Slackware, Debian, FreeBSD
Posts: 10

Rep: Reputation: 0
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


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.
Old 09-03-2004, 03:51 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Do you need to maintain the directory structure?

Assuming they are all different names:
find /wwwroot -name "OLD_*" -exec mv {} /path/to/backup/ \;
Old 09-03-2004, 05:59 PM   #3
LQ Newbie
Registered: Aug 2004
Location: Duluth, MN
Distribution: Slackware, Debian, FreeBSD
Posts: 10

Original Poster
Rep: Reputation: 0

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!!!!
Old 09-03-2004, 06:20 PM   #4
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
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.

Closed Thread

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
Moving files Pyrophorus Slackware 5 11-09-2005 11:47 AM
moving files pantera Programming 2 08-23-2005 06:58 AM
Moving Files arockia Linare 3 09-08-2004 09:14 AM
Help I need help tarring multiple files in multiple directories VisionZ Linux - Newbie 28 03-25-2004 06:25 PM
kde - multiple kickers/moving taskbar? Toker Linux - Newbie 2 10-04-2003 04:31 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration