# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
# Thanks Monica for making this code :)
# This program is used for changing file extensions on files
# eg.
# perl mvfiles.pl /home/username/filelist.txt
# NB file list cannot have \ (backslash) character in them.
# If you want log file of transformation send to log file
# perl mvfiles.pl /home/username/filelist.txt > conversion.log
# syntax of filelist.txt
# multiple lines similar to below
# "/home/username/filename1-you-want-to-change.mp2"
# "/home/username/filename2-you-want-to-change.mp2"
# "/home/username/filename3-you-want-to-change.mp2"
$csvfilename = "$ARGV[0]";
open(HANDLE, $csvfilename) || die ("Couldn't open that file");
@raw_data=
close (HANDLE);
#read each line
foreach $line (@raw_data)
{
chomp ($line);
$line=~ s/"//g;
$oldfile=$line;
# old extension / new extension
$line=~ s/mp2/mp3/;
# prints new file name to screen
print "$line\n";
system(mv,$oldfile,$line);
}
No comments:
Post a Comment