I'm kinda new with the unix shell, and I don't seem to find the answer of my problem :
I have a folder containing multiple files : a correct filename contains exactly 13 characters (numbers + letters + underscore). For example :
1305359000_PS.JPG Some files are named incorrectly, the error always being in the last characters, such as :
9009015000_PS_1.jpg I need to run a find / replace command that would work this way for all the files in my folder :
IF filename > 13 characters (without the extension), then delete every character after the 13th.
I tried some commands with mmv and awk, but i'm stuck so far.
Edit : forgot to precise, the command should consider space(s) in the filename and delete them if present.
9009015000_PS_1.jpgand9009015000_PS_2.jpg? If you simply delete after 13 then you'll end up with the same filename.