tags:

views:

25

answers:

1

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 and PHP.

A: 

Under the hood, any rename command should get implemented with rename(). If you are in the directory where the file is and do:

mv hugefilenamethatiscreweduponandwanttobemuchshorted tersefile

it should work, as I don't think the path would get expanded out and overflow the limit. Otherwise, you can temporarily move the parent directory somewhere so it had a minimal path (like /p) and then rename the file and then move it back.

plinth
Yep, works like a charm. I actually downloaded the source code for rename and found the call to rename(). Didn't expect mv would work differently.
Angad