AT2k Design BBS Message Area
Casually read the BBS message area using an easy to use interface. Messages are categorized exactly like they are on the BBS. You may post new messages or reply to existing messages!

You are not logged in. Login here for full access privileges.

Previous Message | Next Message | Back to Computer Support/Help/Discussion...  <--  <--- Return to Home Page
   Networked Database  Computer Support/Help/Discussion...   [1653 / 1834] RSS
 From   To   Subject   Date/Time 
Message   Arelor    Sean Dennis   rename help under Linux   December 20, 2024
 9:35 AM *  

  Re: rename help under Linux
  By: Sean Dennis to All on Thu Dec 19 2024 10:42 pm

 > Hello everybody!
 >
 > I am trying to find a way under Linux to take files of various names and
 > extentions in a single directory to sequential filenames and not change the
 > extensions.
 >
 > After some research on the interwebz, part of the script is functioning:
 >
 > === Cut ===
 > ## Rename files
 > cd ./pics
 > for i in *.*; do
 >   new=$(printf "%04d.*" "${a}";) #04 pad to length of 4
 >   mv -i -- "$i" "$new"
 >   ((a++))
 > done

Quick one in ksh, try it for filenames that have no special characters and a
single extension (ie no .tar.gz)

i=0
for file in *; do
        extension=`echo "$file" | cut -d . -f 2`
        mv "$file" $i.$extension
        eval let i++
done


--
gopher://gopher.richardfalken.com/1/richardfalken
--- SBBSecho 3.23-Linux
 * Origin: Palantir * palantirbbs.ddns.net * Pensacola, FL * (618:250/24)
  Show ANSI Codes | Hide BBCodes | Show Color Codes | Hide Encoding | Hide HTML Tags | Show Routing
Previous Message | Next Message | Back to Computer Support/Help/Discussion...  <--  <--- Return to Home Page

VADV-PHP
Execution Time: 0.0156 seconds

If you experience any problems with this website or need help, contact the webmaster.
VADV-PHP Copyright © 2002-2025 Steve Winn, Aspect Technologies. All Rights Reserved.
Virtual Advanced Copyright © 1995-1997 Roland De Graaf.
v2.1.250224