LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-15-2009, 02:09 PM   #1
ansatedmemninja
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Rep: Reputation: 0
Smile applying a script to multiple directories


hi fairly new to linux was wondering if there was a way of applying a script to multiple directories. I am trying to move multiple files from directories all of which have file names in lower case and was wondering if there was a command for applying this to multiple directories at the same time.
Currently am having to enter into each of these separate directories in turn which is taking too long. would really appreciate any help.
mv [a-z](new directory).
 
Old 07-15-2009, 02:16 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Move or rename? From where/what to where/what?
 
Old 07-15-2009, 02:19 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
If you use "find", then you can execute a command based on the results. Look at "man find"--in particular, the "exec" options.

Another method would be to have the directory names in a list and iterate thru them using a loop.
 
  


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
Deleting remote directories on multiple hosts with a bash script zirtik Programming 6 04-16-2009 10:52 AM
How to copy one file and to multiple directories using shell script? cebuy Programming 8 03-31-2009 08:04 PM
Script to create multiple directories under users homes shawnbishop Linux - Software 4 03-30-2006 09:11 AM
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 01:23 PM
Script to run script in multiple directories... seabass55 Linux - General 5 07-06-2004 01:44 AM


All times are GMT -5. The time now is 06:33 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration