Bug 9172

Summary: multiple rename (gmc and elsewhere)
Product: [Retired] Red Hat Linux Reporter: Stig Hackvan <stig-redhat-bugzilla>
Component: gmcAssignee: Preston Brown <pbrown>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-02-14 20:10:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stig Hackvan 2000-02-07 04:09:40 UTC
problem:  you can move a bunch of files to the same directory, but you
can't change their names all at once.

solution:  roughly speaking, i want this feature to appear wherever renames
are possible in a gui:  i want to be able to rename a bunch of files all at
once with (perhaps several different options of) a predictable and useful
outcome.

-- stig/jato (pts/5) -- Sun Feb  6 -- 20:07:25 --
-- ...ainofstig.ai/vox/pw/200106 > touch foo bar ; mvnum foo bar fubar
foo -> fubar-1
bar -> fubar-2
-- stig/jato (pts/5) -- Sun Feb  6 -- 20:07:43 --
-- ...ainofstig.ai/vox/pw/200106 > touch foo bar ; mvnum foo bar fubar
foo -> fubar-3
bar -> fubar-4
-- stig/jato (pts/5) -- Sun Feb  6 -- 20:07:45 --
-- ...ainofstig.ai/vox/pw/200106 > rm fubar-*
-- stig/jato (pts/5) -- Sun Feb  6 -- 20:07:54 --
-- ...ainofstig.ai/vox/pw/200106 > touch foo.txt bar.txt ; mvnum foo.txt
bar.txt fubar
foo.txt -> fubar-1.txt
bar.txt -> fubar-2.txt
-- stig/jato (pts/5) -- Sun Feb  6 -- 20:08:30 --
-- ...ainofstig.ai/vox/pw/200106 > touch foo.txt bar.txt ; mvnum foo.txt
bar.txt fubar
foo.txt -> fubar-3.txt
bar.txt -> fubar-4.txt
-- stig/jato (pts/5) -- Sun Feb  6 -- 20:08:31 --
-- ...ainofstig.ai/vox/pw/200106 > touch foo.txt bar.txt bing.c ; mvnum
foo.txt bar.txt bing.c fubar
foo.txt -> fubar-5.txt
bar.txt -> fubar-6.txt
bing.c -> fubar-7.c
-- stig/jato (pts/5) -- Sun Feb  6 -- 20:09:04 --
-- ...ainofstig.ai/vox/pw/200106 > ls fu*
fubar-1.txt  fubar-3.txt  fubar-5.txt  fubar-7.c
fubar-2.txt  fubar-4.txt  fubar-6.txt
-- stig/jato (pts/5) -- Sun Feb  6 -- 20:09:09 --
-- ...ainofstig.ai/vox/pw/200106 > rm fu*
-- stig/jato (pts/5) -- Sun Feb  6 -- 20:09:17 --
-- ...ainofstig.ai/vox/pw/200106 > wh mvnum
mvnum is a function
mvnum ()
{
    : "mvnum <f1> <f2> ... <name-prefix> -- mass file rename";
    perl -e '
    $pre=pop(@ARGV); $n=1;
    foreach $x (@ARGV) {
      $x =~ m/(\.[^.]+)$/;
      do { $y = "$pre-$n$1"; ++$n; } until (! -f $y);
      print "$x -> $y\n";
      rename($x, $y);
    }' "$@"
}

Comment 1 Preston Brown 2000-02-14 20:10:59 UTC
will not be supported in the near future, and probably never by gmc.  May be
supported by its replacement.