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
MP3TAG(1)						      General Commands Manual							 MP3TAG(1)

NAME
mp3tag - view and manipulate ID3v1 tags. SYNOPSIS
mp3tag [ -s song ] [ -a artist ] [ -l album ] [ -y year ] [ -e comment ] [ -k track ] [ -g genre ] [ -r ] file [ file ... ] DESCRIPTION
This manual page briefly documents the mp3tag command. This manual page was written for the Debian GNU/Linux distribution because the orig- inal program does not have one. mp3tag is a program that allows you to both view and manipulate ID3v1 metadata tags. Running the command with just a filename will display the file's current tag. Setting some options will cause the tag to be updated and displayed. OPTIONS
-a artist Set the artist name to artist. Strings over thirty characters are truncated. -e comment Set the comment to comment. Strings over thirty characters are truncated. -g genre Set the genre to genre. This is a single integer with a value of 0 to 254 corresponding to the appropriate Winamp compatible genre (use '-g list' to list all supported genres). -k track Set the track number to track. This is a single integer with a value of 0 to 255. Specifying this field truncates the comment field to twenty-eight characters, as per the ID3v1.1 standard. -l album Set the album name to album. Strings over thirty characters are truncated. -r Merge new tag with any preexisting tag in the file. -s song Set the song name to song. Strings over thirty characters are truncated. -y year Set the year to year. Strings over four characters are truncated. EXAMPLES
Display foo.mp3's current ID3v1 info: mp3tag foo.mp3 Set foo.mp3's artist to 'Bar', and album to 'Baz': mp3tag -a Bar -l Baz foo.mp3 Set foo.mp3's year to 2001, merging it with any tag already present: mp3tag -y 2001 -r foo.mp3 AUTHOR
mp3tag was written by Bram Avontuur <bram@avontuur.org>. This manual page was written by Brian Boucheron <brian@boucheron.org>, for the Debian GNU/Linux distribution (but may be used by others). SEE ALSO
More info on ID3v1 can be found at <http://www.id3.org/id3v1.html>. February 19, 2004 MP3TAG(1)
All times are GMT -4. The time now is 01:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy