Actually our programs do different things. My program changes the header in the file to match the name of the file. Your program changes the name of the file to match the header of the file.
#!/usr/bin/perl
cd "xdir_name" while ($file =
) { $file =~ /xdir_name_(.*)/; $name = $1; open(FILE,$file) || die "Couldn't open file $file $!"; $first_line = <FILE>; $rest = join '',<FILE>; close FILE; open(FILE,"> $file") || die "Couln't write to file $file $!"; print FILE "$name\n$rest"; close FILE; } while ($d=
) { while ($f = <$d/xfile_.*>) { open (F, $f) || (next, die "Can't open $f ($!)\n"; $firstline = <F>; close (F); chomp $firstline; ($firstline ne $d) && (rename ($f, "$firstline/$f") || die "Can't move $f to $firstline/$f ($!)\n"); } }
-- Stephen Montgomery-Smith Department of Mathematics, University of Missouri, Columbia, MO 65211 Phone 573-882-4540, fax 573-882-1869 http://www.math.missouri.edu/~stephen stephen@math.missouri.edu -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/