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.
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)
## Rename files
cd ./pics
for i in *.*; do
new=$(printf "%04d.*" "${a}") #04 pad to length of 4
mv -i -- "$i" "$new"
((a++))
done
| Sysop: | Sarah |
|---|---|
| Location: | Portland, Oregon |
| Users: | 162 |
| Nodes: | 16 (0 / 16) |
| Uptime: | 28:59:30 |
| Calls: | 1,130 |
| Calls today: | 1,130 |
| Files: | 84,990 |
| U/L today: |
554 files (10,683M bytes) |
| D/L today: |
3,774 files (9,116M bytes) |
| Messages: | 65,772 |
| Posted today: | 54 |