i have a perl script that pulls files location using cleartool command line. It pulls the file locaitons and then inputs them into a text file and then opens the window for me. I was wondering how i can remove some of the first letters from the text file
example in the text file would
M:\viewname\application\fi
le\file.jp
g
I would like to remove the M:\viewname via the script
Any ideas?
here is the script i am working with:
#! c:/perl-8.5.0/bin/perl
#use warnings;
#$old = "09/06/2004"; # files older than this who cares.
sub new_path
{
local ($ask_prompt) = @_;
$ask_promt="\"$ask_prompt\
"";
$answer = system ("clearprompt text -outfile element -default %C://diff_list.txt% ^-prompt $ask_promt");
return $answer;
}
##########################
##########
##########
##########
##########
##########
##########
#
new_path ("What directory to pull info?"); #Call to search sub above
open LOCATION, element or die "could not open path for reading: $!"; #
$path = <LOCATION>;
close LOCATION;
print "$path\n";
print "file being created in c:/temp/logged_media.txt\n
";
system ("del c:\\temp\\logged_media.txt
");
open( PIPES, "dir/s $path |") || die "canot open dir pipe: $!";
@dirlist = <PIPES>;
close PIPES;
$dir = '';
FILE: foreach $file (@dirlist) {
#print "file: $file\n";
$_ = $file;
chomp $_;
m/^[\s\n\r]*$/ && next FILE; # skip empty lines
m/^\s*Volume/i && next FILE; # skip Volume lines
m/\s+\.?\.$/ && next FILE; # skip . and ..
m/^\s*Total\s+/i && next FILE; # skip summary
m/^\s*Directory/i && do { (@d[0..2], $dir) = split /\s+/, $file; next FILE; };
($date, $time, $zone, $size, $name) = split /\s+/, $file; # 11/20/2002 10:26 AM 1,115 happy.txt
next FILE if ($size eq '<DIR>'); # skip directories
next FILE if ($zone eq 'File(s)'); # skip summary
next FILE if ($name eq 'bytes'); # skip summary
if ($size > 0 ){
if ($name =~ (/\w+\.+/)) {
system("cleartool ls -short $dir\\$name >> c://temp//logged_media.txt
");
}
}
print "DONE";
}
system("notepad.exe c://temp//logged_media.txt
");