Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.8 KiB

  1. #!/usr/bin/perl
  2. 'di';
  3. 'ig00';
  4. #
  5. # $RCSfile: rename,v $$Revision: 4.1 $$Date: 92/08/07 17:20:30 $
  6. #
  7. # $Log: rename,v $
  8. ($op = shift) || die "Usage: rename perlexpr [filenames]\n";
  9. if (!@ARGV) {
  10. @ARGV = <STDIN>;
  11. chop(@ARGV);
  12. }
  13. for (@ARGV) {
  14. $was = $_;
  15. eval $op;
  16. die $@ if $@;
  17. rename($was,$_) unless $was eq $_;
  18. }
  19. ##############################################################################
  20. # These next few lines are legal in both Perl and nroff.
  21. .00; # finish .ig
  22. 'di \" finish diversion--previous line must be blank
  23. .nr nl 0-1 \" fake up transition to first page again
  24. .nr % 0 \" start at page 1
  25. ';<<'.ex'; #__END__ ############# From here on it's a standard manual page ############
  26. .TH RENAME 1 "July 30, 1990"
  27. .AT 3
  28. .SH NAME
  29. rename \- renames multiple files
  30. .SH SYNOPSIS
  31. .B rename perlexpr [files]
  32. .SH DESCRIPTION
  33. .I Rename
  34. renames the filenames supplied according to the rule specified as the
  35. first argument.
  36. The argument is a Perl expression which is expected to modify the $_
  37. string in Perl for at least some of the filenames specified.
  38. If a given filename is not modified by the expression, it will not be
  39. renamed.
  40. If no filenames are given on the command line, filenames will be read
  41. via standard input.
  42. .PP
  43. For example, to rename all files matching *.bak to strip the extension,
  44. you might say
  45. .nf
  46. rename 's/\e.bak$//' *.bak
  47. .fi
  48. To translate uppercase names to lower, you'd use
  49. .nf
  50. rename 'y/A-Z/a-z/' *
  51. .fi
  52. .SH ENVIRONMENT
  53. No environment variables are used.
  54. .SH FILES
  55. .SH AUTHOR
  56. Larry Wall
  57. .SH "SEE ALSO"
  58. mv(1)
  59. .br
  60. perl(1)
  61. .SH DIAGNOSTICS
  62. If you give an invalid Perl expression you'll get a syntax error.
  63. .SH BUGS
  64. .I Rename
  65. does not check for the existence of target filenames, so use with care.
  66. .ex