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...   [1649 / 1834] RSS
 From   To   Subject   Date/Time 
Message   Sean Dennis    All   rename help under Linux   December 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
=== Cut ===

This works but it assigns "*" as the file extension.

Could I try using "find" instead?

I know there are solutions (renameutils, the "File::Rename" Perl code) but 
they don't work for my needs.

-- Sean

... Adultery is the application of democracy to love.
--- GoldED+/LNX 1.1.5-b20240209
 * Origin: Outpost BBS * Johnson City, TN (618:618/1)
  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.0159 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