Renaming long filenames

I am screwed. I misused wildcards like a moron, in the rename command.
I repeated names twice in a 3gig folder, which I cannot afford to delete.
Now, the rename command is not working, and it says the file name is too long.

Please help me.
If programming can solve this, please let me know. I am a competent programmer in Java, PHP, and I know basic C.

Open a terminal in the directory

Lets assume the file is called: imabigfilename.txt

try this

mv imabigfilename.txt smallfilename.txt

Worked. What a life saver. Many thanks :slight_smile:

Hi,

What exactly do you want to do? The rename command is not for renaming files from old to new file name but for fixing e. g. numbered file names or file extensions like this


rename .htm .html *.htm

which means "Search for *.htm and change the extension from htm to html. Could you give us an example what exactly the problem is. I think to rename the files with mv in a 3 gig folder will cause a load of work. :wink:

Bye

Erik

Hello Angadude,

Please take a look at a software package called “fslint”.

It is a tool that performs various types of clean-up on large numbers of files in an automated way. Two of the sub-features that may interest you are called “Bad names” and “Name clashes”.

FSlint - Duplicate file finder for linux

Best of luck!

Thanks for the info on Fslint. Interesting application.
Definitely beats writing my own find program.
Looks like I’m going to have my hands filled getting rid of duplicates.

On 2010-08-09, tararpharazon <tararpharazon@no-mx.forums.opensuse.org> wrote:

> Looks like I’m going to have my hands filled getting rid of duplicates.

Duplicate what? Names? Or file content?

I have a script that replaces identical files with links to each other. Just
to save space, you know.

That could easly be changed to only list the identical files, without taking
any action.

Any use to you ?


When in doubt, use brute force.
– Ken Thompson

Thanks, no I don’t think so. I want to get rid of duplicates. Mostly the same files in different locations, look-alike photos, cached .pngs.

Sadly, afile.txt from folder ~/download is a duplicate to afile.txt in ~/documents, and bfile.txt in ~/folder/bbbc is a duplicate of bfile.txt in ~/folder/123ts. Then self asks self what and why do I have a ~/folder/123ts? :wink: