Sponsored Content
Full Discussion: Renaming a Number of Files
Top Forums UNIX for Dummies Questions & Answers Renaming a Number of Files Post 302204884 by doraiashok on Thursday 12th of June 2008 09:09:17 PM
Old 06-12-2008
You might want to write a shell script. First get the list of bands then loop for each band by listing their album name and then loop for each song.

This might not be accurate but you might be able to get it to work,

Code:
mpath="/MyMusic"
for band in `ls -p $mpath | grep "/$" | cut -d"/" -f1`
do
  bandpath="$mpath/$band"
  for album in `ls -p $bandpath | grep "/$" | cut -d"/" -f1`
  do
     albumpath="$bandpath/$album"
     cd $albumpath
     fl_lst=`ls *.mp3`
     cd - > /dev/null
     for fl in $fl_lst
     do
        cp $mpath/$band/$album/$fl $mpath/$band-$album-$fl
     done
  done
done

I am using cp instead of mv so that you can test it out. you if you think it works, just change 'cp' to 'mv'

-kj

Last edited by Yogesh Sawant; 06-13-2008 at 02:15 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

renaming the files

Hi All, Today I got a small problem while handling zipped files in PROD support. There are files in this format and I had to grep them reading some contents A.B.gz.C.D where A,B,C and D stand for variables (like FIRST.NAME.gz.MIDDLE.LAST). I know that these files are zipped files and If I... (1 Reply)
Discussion started by: adurga
1 Replies

2. UNIX for Dummies Questions & Answers

renaming files

directory name = /usr/tom/1997 files - ABC_1997_ST1_BCD.SQL BCD_1997_ST1_EFG_SAB.SQL TTT_EBC_1997_ST1_A.SQL sub directory - /usr/tom/1997/jan a) I want to just rename the all files ending with '.SQL' and also its contents in the 1997 directory(excluding subdirectories eg... (3 Replies)
Discussion started by: systemsb
3 Replies

3. Shell Programming and Scripting

renaming and number padding using directory as guide, help

I need to take a series of image files, all numbered consecuativly, that were recently dumped in a directory and rename them to pieces of the directories path. Assume all directories are structured as this one so that I may use this script to easly sort and rename files. pt.1 path :... (3 Replies)
Discussion started by: TiredOrangeCat
3 Replies

4. UNIX for Advanced & Expert Users

Renaming files

Hello Please can someone help. We are being sent a directiory full of images. The names of these images can vary in length and have spaces in them. example: nn 999999 nnnnn nnnn nnnn nn nnn nnn nn nnnn.pdf what we want to do is rename all the images. Take the first two fields nn 999999 and... (23 Replies)
Discussion started by: Dolph
23 Replies

5. Shell Programming and Scripting

renaming files or adding a name in the beginning of all files in a folder

Hi All I have a folder that contains hundreds of file with a names 3.msa 4.msa 21.msa 6.msa 345.msa 456.msa 98.msa ... ... ... I need rename each of this file by adding "core_" in the begiining of each file such as core_3.msa core_4.msa core_21.msa (4 Replies)
Discussion started by: Lucky Ali
4 Replies

6. UNIX for Dummies Questions & Answers

Renaming Files With 2 .

Dear All expertise.. just wanna ask if there is a way on how to change the filename as per below sample:- filename:- cob120514093156.03.466926330 CCBS-CPMM_SEND_COB_120514_100549_3.rpt to convert to:- cob120514093156.03.466926330.bd (rename from cob120514093156.03.466926330) ... (17 Replies)
Discussion started by: yokomo
17 Replies

7. Shell Programming and Scripting

How to count number of files in directory and write to new file with number of files and their name?

Hi! I just want to count number of files in a directory, and write to new text file, with number of files and their name output should look like this,, assume that below one is a new file created by script Number of files in directory = 25 1. a.txt 2. abc.txt 3. asd.dat... (20 Replies)
Discussion started by: Akshay Hegde
20 Replies

8. Shell Programming and Scripting

Renaming the file name for n number of files

Hi , I am kind of new to shell scripting and found a situation to handle ... I have few files which will be ftpd in to our sustem , the file names needs to be renamed based on condition. ------------ Eg file names :- AE_JUNFOR_2013_MTD_2013-04-09-08-30-09.TXT... (6 Replies)
Discussion started by: chillblue
6 Replies

9. Shell Programming and Scripting

Renaming multiple files in sftp server in a get files script

Hi, In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this? I am using #!/bin/ksh For eg: sftp user@host <<EOF cd /path get *.txt rename *.txt *.txt.done ... (7 Replies)
Discussion started by: jhilmil
7 Replies

10. Shell Programming and Scripting

Renaming a file with sequence number

Hi team, I need a script for renaming a file with sequence number. script get a file from one directory, /home/billing/Cmm/sms/sms_tmp, append sequence no at the end of file name and move a file to other directory, /home/billing/Cmm/sms/. Actual file is cdr201508271527, and file after... (10 Replies)
Discussion started by: mfaizan40
10 Replies
rhythmbox(1)						      General Commands Manual						      rhythmbox(1)

NAME
rhythmbox-client - controls a running instance of rhythmbox SYNOPSIS
rhythmbox-client [option...][file...] DESCRIPTION
rhythmbox-client is a tool for controlling an already running instance of rhythmbox. It's useful for remote control scripting, adding spe- cific files to the library from the shell, or printing details of what's playing. Any files specified after the option arguments will be added to the library. If the --enqueue option is given, the files will also be added to the play queue. OPTIONS
-?,--help Show help options --debug Enable debug output --no-start Do not start a new instance of rhythmbox --quit Quit rhythmbox --no-present Don't present an existing rhythmbox window --hide Hide the rhythmbox window --next Jump to next song --previous Jump to previous song --notify Show notification of the playing song --play Resume playback if currently paused --pause Pause playback if currently playing --play-pause Toggle play/pause mode --play-uri=URI Play a specified URI, importing it if necessary --enqueue Add specified tracks already in the library to the play queue --clear-queue Empty the play queue before adding new tracks --print-playing Print the title and artist of the playing song --print-playing-format=format Print formatted details of the song (see FORMAT OPTIONS below). --set-volume Set the playback volume --volume-up Increase the playback volume --volume-down Decrease the playback volume --print-volume Print the current playback volume --mute Mute playback --unmute Unmute playback --select-source=URI Select the source corresponding to a URI (device or mount point) --activate-source=URI Select the source corresponding to a URI (device or mount point) and start playing from it if not already playing. --play-source=URI Select the source corresponding to a URI (device or mount point) and start playing from it. FORMAT OPTIONS
%at album title %aa album artist %aA album artist (lowercase) %as album artist sortname %aS album artist sortname (lowercase) %ay album year %ag album genre %aG album genre (lowercase) %an album disc number %aN album disc number, zero padded %st stream title %tn track number (i.e 8) %tN track number, zero padded (i.e 08) %tt track title %ta track artist %tA track artist (lowercase) %ts track artist sortname %tS track artist sortname (lowercase) %td track duration %te track elapsed time Variables can be combined using quotes. For example "%tn %aa %tt", will print the track number followed by the artist and the title of the track. AUTHOR
This manual page was written by Sven Arvidsson <sa@whiz.se>, for the Debian system (but may be used by others). SEE ALSO
rhythmbox(1). GNOME
2007-06-28 rhythmbox(1)
All times are GMT -4. The time now is 01:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy