LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to remove bad filename pattern from every file in one folder? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-remove-bad-filename-pattern-from-every-file-in-one-folder-740444/)

jaytd 07-16-2009 02:29 AM

How to remove bad filename pattern from every file in one folder?
 
Hello Guys,
i need help with a big problem. After unpacking an iso file i get very strange reults. Every File that was unpacked gets the extension ';1' in the end. For example: start.exe;1 or picture.jpg;1

Now my question is how to remove this bad extension from every file in this folder without doing every single file by hand. May there is also a method to prevent this failure. Thank you for your Help!

jaytd

PMP 07-16-2009 02:43 AM

try this out,

Make sure u have a backup of the files first
Code:

for i in *; do nn=`echo $i| cut -d";" -f1`; mv $i $nn;  done

i92guboj 07-16-2009 02:47 AM

Another one:

Code:

for i in *; do mv "$i" "${i/\;1/}"; done
In bash, only. However, I am nore concerned about the *why* are those files being screwed. But, if you are sure that their contents is ok, then you can rename them this way.

jaytd 07-16-2009 02:55 AM

Their contents are okay. The way this ending appears is always the same: I got a simple .iso file. Then i right click on it and press "extract here". Everything works fine but i get these endings on every file that was inside the .iso file. Renaming them makes them usable again. Thank you for your answers!


All times are GMT -5. The time now is 06:24 AM.