03-31-2011
Script to move files with similar names to folder
I have in directory /media/AUDIO/WAVE many .mp3 files with names like:
my filename_01of02.mp3
my filename_02of02.mp3
Your File_01of06.mp3
Your File_02of06.mp3
etc....
In the same directory, /media/AUDIO/WAVE, I have many folders with names like
9780743579490
9780743579491
etc..
Inside the folders I have files:
(Inside folder 9780743579490 is)
9780743579490_01of6_Your File.wav
9780743579490_02of6_Your File.wav
What I need, is a script to find what folder the .wav files that have the same filename at the .mp3 files in /media/AUDIO/WAVE, and move the mp3 files into the folders with the wav files that share the same file name.
To be clear the mp3 part "01of06" is in a different place than the .wav file and the wav file has a 13 digit number in the beginning that the mp3 doesnt, so you will have to match what happens before the first underscore on the mp3 file with what happens between the last underscore and the file extension in the .wav file!
Last edited by glev2005; 04-01-2011 at 10:47 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello Friends,
I have .tar files which exists under different directories after the below code is run:
find . -name "*" -type f -print | grep .tar > tmp.txt
cat tmp.txt
./dir1/subdir1/subdir2/database-db1_28112009.tar
./dir2/subdir3/database-db2_28112009.tar... (2 Replies)
Discussion started by: EAGL€
2 Replies
2. Linux
Hi Team,
I have over 1 lakh pdf files.
I want to create folders like Disk-1, Disk-2 ..... & want to move 3000 pdfs per folder. Can i do it by script? Please help me.
Thanks & Regards
Parag Nehete (4 Replies)
Discussion started by: paragnehete
4 Replies
3. Shell Programming and Scripting
I have two files like this:
fileA.net
A
B
C
fileA.dat
1
2
3
and I want the output
output_expected
A 1
B 2
C 3
I know that the easier way is to do a paste fileA.net fileA.dat, but the problem is that I have 10,000 couple of files (fileB.net with fileB.dat; fileC.net with... (3 Replies)
Discussion started by: valente
3 Replies
4. Shell Programming and Scripting
Hi All,
I have to requirement to write a shell script to move file from one folder (A) to another five folder (B,C,D,E,F) and destination folder should be blank. In not blank just skip.
This script will run as a scheduler every 2 minutes. It will check number of files in folder A and move 1 to... (9 Replies)
Discussion started by: peekuabc
9 Replies
5. Shell Programming and Scripting
So, I have a directory tree that has many files named thusly:
X_REVY.PDF
I need to find any files that have the same X portion (which can be nearly anything) as any another file (in any directory) but have different Y portions (which can be any number from 1-99).
I then need it to return... (3 Replies)
Discussion started by: Kamezero
3 Replies
6. Shell Programming and Scripting
Hi,
I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location.
Ex:
mainfolder1
file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure.
rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies
7. Shell Programming and Scripting
I want to move a folder with spaces from one folder to another.
I have two folders like this,
1).RT_032-222 -4444-01/ 2). RT_032-555 -7777-01/
I want to move files from 2 to 1 through shell script.Here I want to assign this like a user defined variable like as Source branch... (2 Replies)
Discussion started by: kannansoft1985
2 Replies
8. Shell Programming and Scripting
Hello,
I need to move all the files inside /XYZ (has multi-depth sub directories) that are older than 14 days to/ABC directory but with retaining the SAME directory structure.
for example:
/XYZ/1/2/3/A/b.txt should be moved as /ABC/1/2/3/A/b.txt
I know about find /XYZ -type f -mtime +14... (3 Replies)
Discussion started by: prvnrk
3 Replies
9. Shell Programming and Scripting
We are receiving few zipped files in one location say : apple/oranges/incoming
All .zip files are placed here in incoming folder.
So few of the files are password encrypted.
There are only 10 zipped files, so we are planning to create a script which will pick that zip file from incoming... (1 Reply)
Discussion started by: Sidhant
1 Replies
10. Shell Programming and Scripting
Hi Team,
I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder.
Eg:
parent folder --> /Interface/data/test/IN
Sub folder -->/Interface/data/test/IN/Invoice20180607233338
Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies
LEARN ABOUT DEBIAN
mp3::tag::id3v1
MP3::Tag::ID3v1(3pm) User Contributed Perl Documentation MP3::Tag::ID3v1(3pm)
NAME
MP3::Tag::ID3v1 - Module for reading / writing ID3v1 tags of MP3 audio files
SYNOPSIS
MP3::Tag::ID3v1 is designed to be called from the MP3::Tag module.
use MP3::Tag;
$mp3 = MP3::Tag->new($filename);
# read an existing tag
$mp3->get_tags();
$id3v1 = $mp3->{ID3v1} if exists $mp3->{ID3v1};
# or create a new tag
$id3v1 = $mp3->new_tag("ID3v1");
See MP3::Tag for information on the above used functions.
* Reading the tag
print " Title: " .$id3v1->title . "
";
print " Artist: " .$id3v1->artist . "
";
print " Album: " .$id3v1->album . "
";
print "Comment: " .$id3v1->comment . "
";
print " Year: " .$id3v1->year . "
";
print " Genre: " .$id3v1->genre . "
";
print " Track: " .$id3v1->track . "
";
# or at once
@tagdata = $mp3->all();
foreach $tag (@tagdata) {
print $tag;
}
* Changing / Writing the tag
$id3v1->comment("This is only a Test Tag");
$id3v1->title("testing");
$id3v1->artist("Artest");
$id3v1->album("Test it");
$id3v1->year("1965");
$id3v1->track("5");
$id3v1->genre("Blues");
# or at once
$id3v1->all("song title","artist","album","1900","comment",10,"Ska");
$id3v1->write_tag();
* Removing the tag from the file
$id3v1->remove_tag();
AUTHOR
Thomas Geffert, thg@users.sourceforge.net
DESCRIPTION
title(), artist(), album(), year(), comment(), track(), genre()
$artist = $id3v1->artist;
$artist = $id3v1->artist($artist);
$album = $id3v1->album;
$album = $id3v1->album($album);
$year = $id3v1->year;
$year = $id3v1->year($year);
$comment = $id3v1->comment;
$comment = $id3v1->comment($comment);
$track = $id3v1->track;
$track = $id3v1->track($track);
$genre = $id3v1->genre;
$genre = $id3v1->genre($genre);
Use these functions to retrieve the date of these fields, or to set the data.
$genre can be a string with the name of the genre, or a number describing the genre.
all()
@tagdata = $id3v1->all;
@tagdata = $id3v1->all($title, $artist, $album, $year, $comment, $track, $genre);
Returns all information of the tag in a list. You can use this sub also to set the data of the complete tag.
The order of the data is always title, artist, album, year, comment, track, and genre. genre has to be a string with the name of the
genre, or a number identifying the genre.
fits_tag()
warn "data truncated" unless $id3v1->fits_tag($hash);
Check whether the info in ID3v1 tag fits into the format of the file.
as_bin()
$str = $id3v1->as_bin();
Returns the ID3v1 tag as a string.
write_tag()
$id3v1->write_tag();
[old name: writeTag() . The old name is still available, but you should use the new name]
Writes the ID3v1 tag to the file.
remove_tag()
$id3v1->remove_tag();
Removes the ID3v1 tag from the file. Returns negative on failure, FALSE if no tag was found.
(Caveat: only one tag is removed; some - broken - files may have many chain-loaded one after another; you may need to call remove_tag()
in a loop to handle such beasts.)
[old name: removeTag() . The old name is still available, but you should use the new name]
genres()
@allgenres = $id3v1->genres;
$genreName = $id3v1->genres($genreID);
$genreID = $id3v1->genres($genreName);
Returns a list of all genres, or the according name or id to a given id or name.
new()
$id3v1 = MP3::Tag::ID3v1->new($mp3fileobj[, $create]);
Generally called from MP3::Tag, because a $mp3fileobj is needed. If $create is true, a new tag is created. Otherwise undef is
returned, if now ID3v1 tag is found in the $mp3obj.
Please use
$mp3 = MP3::Tag->new($filename);
$id3v1 = $mp3->new_tag("ID3v1"); # Empty new tag
or
$mp3 = MP3::Tag->new($filename);
$mp3->get_tags();
$id3v1 = $mp3->{ID3v1}; # Existing tag (if present)
instead of using this function directly
SEE ALSO
MP3::Tag, MP3::Tag::ID3v2
ID3v1 standard - http://www.id3.org
COPYRIGHT
Copyright (c) 2000-2004 Thomas Geffert. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, distributed with Perl.
perl v5.14.2 2009-11-28 MP3::Tag::ID3v1(3pm)