Sponsored Content
Full Discussion: New Directories from Files
Top Forums Shell Programming and Scripting New Directories from Files Post 60730 by Phobos on Thursday 20th of January 2005 09:15:17 PM
Old 01-20-2005
New Directories from Files

The Dilemma:
I have a huge directory filled with Music, in fact about 8,000 songs. I now want to separate all these songs into sub folders by the artist's name. Most all the song files are in the form of "Song Artist - Song Title." For example, Bach - Allegro ma non troppo.mp3. Now what I want is a script that would go through all these files and take the string before the "-" and use that to create a directory with that name, then place all the files which start with that string in the newly created sub folder. I have a small knowledge of shell scripting, but know Java and Cpp. I know in java that I could use a string tokenizer to accomplish some of this, but I have no idea how to shell script this problem.

Thanks in advance,
Robert

BTW, I am running Red Hat Linux 8.0, using bourne.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

mget * (obtein files from current directory but not the files form sub-directories)

Hello, Using the instruction mget (within ftp) and with "Interactive mode off", I want to get all files from directory (DirAA), but not the files in sub-directories. The files names don't follow any defined rule, so they can be just letters without (.) period Directory structure example: ... (0 Replies)
Discussion started by: Peter321
0 Replies

2. Shell Programming and Scripting

compare files in two directories and output changed files to third directory

I have searched about 30 threads, a load of Google pages and cannot find what I am looking for. I have some of the parts but not the whole. I cannot seem to get the puzzle fit together. I have three folders, two of which contain different versions of multiple files, dist/file1.php dist/file2.php... (4 Replies)
Discussion started by: bkeep
4 Replies

3. UNIX for Dummies Questions & Answers

List directories and sub directories recursively excluding files

Hi, Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process. I wanted to disply using a unix command all the directories recursively excluding files. I tried 'ls -FR' but that display files as... (3 Replies)
Discussion started by: pointers
3 Replies

4. Shell Programming and Scripting

How to store files/directories in different directories!!

Hi legends, I am writing a script, in that my requirement is, if all the fill types stored in one directory from that we need to separate different different directories based on the file types. for example in a directory(anish). 5 different types files 1- directory 2- .txt files 2- .sh... (1 Reply)
Discussion started by: anishkumarv
1 Replies

5. Shell Programming and Scripting

How to access files from different directories and to perform search action in those files?

Hi, I want to access files from different directories (for example: /home/dir1/file1 , /home/dir2/file2 ...) Like this i have to access these files(file1, file2...). (3 Replies)
Discussion started by: bangarukannan
3 Replies

6. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

7. Shell Programming and Scripting

Rename the files in all the directories and sub-directories

Hi all, I have more than 12000 files in 46 different directories and each directory has 2 sub-directories named “dat” or “gridded”. Dat sub-directories have files with extension “jpg.dat” and gridded sub-directories have files with extension “.jpg”. I need to... (1 Reply)
Discussion started by: AshwaniSharma09
1 Replies

8. UNIX for Advanced & Expert Users

Find all files in the current directory excluding hidden files and directories

Find all files in the current directory only excluding hidden directories and files. For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided. `find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Discussion started by: ksailesh1
7 Replies

9. Shell Programming and Scripting

Archiving and moving files into directories, creating directories, etc.

how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex. so mydemo--2015-03-23-1500.tar.gz > database -... (5 Replies)
Discussion started by: wyclef
5 Replies
POE::Component::Client::MPD::Collection(3pm)		User Contributed Perl Documentation	      POE::Component::Client::MPD::Collection(3pm)

NAME
POE::Component::Client::MPD::Collection - module handling collection commands VERSION
version 1.121670 DESCRIPTION
POE::Component::Client::MPD::Collection is responsible for handling general purpose commands. They are in a dedicated module to achieve easier code maintenance. To achieve those commands, send the corresponding event to the POE::Component::Client::MPD session you created: it will be responsible for dispatching the event where it is needed. Under no circumstance should you call directly subs or methods from this module directly. Read POE::Component::Client::MPD's pod to learn how to deal with answers from those commands. Following is a list of collection-related events accepted by POCOCM. RETRIEVING SONGS &; DIRECTORIES coll.all_items( [$path] ) Return all Audio::MPD::Common::Items (both songs & directories) currently known by mpd. If $path is supplied (relative to mpd root), restrict the retrieval to songs and dirs in this directory. coll.all_items_simple( [$path] ) Return all Audio::MPD::Common::Items (both songs & directories) currently known by mpd. If $path is supplied (relative to mpd root), restrict the retrieval to songs and dirs in this directory. /! Warning: the Audio::MPD::Common::Item::Song objects will only have their attribute file filled. Any other attribute will be empty, so don't use this sub for any other thing than a quick scan! coll.items_in_dir( [$path] ) Return the items in the given $path. If no $path supplied, do it on mpd's root directory. Note that this sub does not work recusrively on all directories. RETRIEVING THE WHOLE COLLECTION
coll.all_albums( ) Return the list of all albums (strings) currently known by mpd. coll.all_artists( ) Return the list of all artists (strings) currently known by mpd. coll.all_titles( ) Return the list of all titles (strings) currently known by mpd. coll.all_files( ) Return a mpd_result event with the list of all filenames (strings) currently known by mpd. PICKING A SONG
coll.song( $path ) Return the Audio::MPD::Common::Item::Song which correspond to $path. coll.songs_with_filename_partial( $string ) Return the Audio::MPD::Common::Item::Songs containing $string in their path. SONGS, ALBUMS &; ARTISTS RELATIONS coll.albums_by_artist( $artist ) Return all albums (strings) performed by $artist or where $artist participated. coll.songs_by_artist( $artist ) Return all Audio::MPD::Common::Item::Songs performed by $artist. coll.songs_by_artist_partial( $artist ) Return all Audio::MPD::Common::Item::Songs performed by $artist. coll.songs_from_album( $album ) Return all Audio::MPD::Common::Item::Songs appearing in $album. coll.songs_from_album_partial( $string ) Return all Audio::MPD::Common::Item::Songs appearing in album containing $string. coll.songs_with_title( $title ) Return all Audio::MPD::Common::Item::Songs which title is exactly $title. coll.songs_with_title_partial( $string ) Return all Audio::MPD::Common::Item::Songs where $string is part of the title. AUTHOR
Jerome Quelin COPYRIGHT AND LICENSE
This software is copyright (c) 2007 by Jerome Quelin. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-15 POE::Component::Client::MPD::Collection(3pm)
All times are GMT -4. The time now is 06:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy