LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to remane a number of files? (https://www.linuxquestions.org/questions/linux-general-1/how-to-remane-a-number-of-files-488448/)

AGazzaz 10-01-2006 07:40 AM

How to remane a number of files?
 
Hello,
I want to rename some files so they are
agazzaz_1
agazzaz_2
agazzaz_3
and so on

how can this be done?

Andrew Benton 10-01-2006 08:50 AM

Code:

x=1
for i in $(echo a_file another_file something_else)
do mv $i agazzaz_$((x++))
done

Change `a_file another_file something_else' for the actual names of the files you want to move

trickykid 10-01-2006 09:20 AM

Quote:

Originally Posted by Andrew Benton
Code:

x=1
for i in $(echo a_file another_file something_else)
do mv $i agazzaz_$((x++))
done

Change `a_file another_file something_else' for the actual names of the files you want to move

And if it's a huge number of files, get the list of files in their own file and you can do something like..

for i in `cat list-of-files`
do
mv $i agazzaz_$((x++))
done

AGazzaz 10-01-2006 11:52 AM

thank you for your replies

but i did not even understand what to do so i googled a little bit and i found

http://filerenameutils.sourceforge.net/

so what do you think

ps. i have not used it yet


All times are GMT -5. The time now is 03:17 AM.