LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2013, 04:33 PM   #1
yoczor
LQ Newbie
 
Registered: Dec 2013
Posts: 1

Rep: Reputation: Disabled
Smile Writing a script that copy files to sub folder


I need your help in writing a script. suppose i have a folder in a certain name and i want to copy all the files i have to sub-folder that starts with the first letter of the file. for instance, a file named alaska will be copied to folder A, the file named colorado will be cppied to folder C and so on. of course it will include files with lowercase and uppercase letters and a folder with one uppercase letter.

thanks.
 
Old 12-08-2013, 03:32 AM   #2
Sydney
Member
 
Registered: Mar 2012
Distribution: Scientific Linux
Posts: 147

Rep: Reputation: 36
Look into using wild cards with the mv command. Look at the -f and -d conditionals in bash shell scripts. Last or maybe first look up how to read the contents of a directory into a bash shell script.
 
  


Reply



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
[SOLVED] shell script to copy files into folder that matches the file name daveant Linux - Newbie 5 12-07-2011 07:28 AM
[SOLVED] Using terminal command -Find files in a folder and copy them to a different folder j-jock Linux - General 4 11-28-2011 02:20 AM
Noob questions: making script to copy files to another folder supernova88 Linux - Newbie 8 06-06-2011 01:52 AM
i need to copy files from one folder to another folder using shell anurupr Linux - Newbie 17 03-04-2010 09:07 AM
How to copy in a script files to a samba folder? Julianus Linux - Networking 1 10-09-2004 07:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:29 AM.

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
Open Source Consulting | Domain Registration