The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
GUI shell script for Linux mr_aliagha Shell Programming and Scripting 0 12-05-2008 10:28 AM
how to encrypt my shell script program in linux akm9999 Shell Programming and Scripting 3 09-09-2008 04:30 AM
Linux Shell Question: how to print the shell script name ? meili100 UNIX for Dummies Questions & Answers 3 07-01-2008 01:55 PM
porting shell script from Linux to AIX. joy_1 Shell Programming and Scripting 6 12-27-2007 02:57 AM
Wrong Shell Invoking My Script On Linux kowrip Shell Programming and Scripting 3 09-10-2003 10:18 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-26-2009
emachala emachala is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 1
help with linux shell script

HI im a novice with shell scripts but i need help with a random script I have this folder filled with 500 different file names... I need help creating a script that will take each filename and make a new folder named that filename and then move that file into the newly created folder. Then the script will move to the next file in the folder and repeat till all 500 folder have been made and files have been moved into them...

If anyone can help me i would apprieate it so much

Thanks Eric
  #2 (permalink)  
Old 01-26-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361

Against my better judgement, since this sounds like homework:

Code:
cd /path/to/folder ## adjust to taste
for file in *
do
  mkdir temp && mv "$file" temp && mv temp "$file"
done
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0