GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Command to rename file extensions on a server? (https://gfy.com/showthread.php?t=231961)

chodadog 02-06-2004 06:29 AM

Command to rename file extensions on a server?
 
I need to change .JPG to .jpg in a particular folder. Needs to do subfolders too. Thanks.

broke 02-06-2004 06:32 AM

What OS?

keyDet79 02-06-2004 06:35 AM

mv in nix, ren in win

chodadog 02-06-2004 06:35 AM

Hrm. I don't even know. It's not my server. Uploading something for a client. Didn't notice that the file extensions were wrong (windows not being case sensitive and all). I shall find out.

com 02-06-2004 06:37 AM

execute:

cd /path/to/folder; ls -al | grep JPG | awk '{print $9, $9}' >shit && vi shit

in vi hit escape, delete the top two lines (should be "." and "..", these can be deleted by hitting "d" twice, followed by shift-colon, at the colon prompt enter this sequence:

%s/^/mv /g

enter after that, simply change the second colum to have lower case jpg at the end. escape back to shell and save by hitting escape shift-colon and at the prompt enter:

wq!

at the prompt execute:

sh shit

I would explain how to do it for all files etc... but that's getting a bit tricky and wouldnt want to do so without seeing the file structure myself. be careful!

Weppel 02-06-2004 06:37 AM

Could be done by a simple shellscript, or a php script, whatever you want ;)

chodadog 02-06-2004 06:40 AM

Ooh. if it can be done with a php script, that would be great. Could someone be so kind as to give me the code? Thanks.

directfiesta 02-06-2004 07:07 AM

Why dont you just delete the files you uploaded. Then, on your pc, do a batch rename of the extension with Namewiz or any other renaming proggie. Then re-upload the shit.

Much safer than going in " shell" by telnet....

Or if not too many, use an FTP like shell manager:

F-Securee SSH file transfer. If interested, could post the link...

com 02-06-2004 07:25 AM

regular expressions own!
I've always wished that this was syntactically correct:

# mv *.WHATEVER *.whatever

hehe

blazin 02-06-2004 09:15 AM

Quote:

Originally posted by com
execute:

cd /path/to/folder; ls -al | grep JPG | awk '{print $9, $9}' >shit && vi shit

in vi hit escape, delete the top two lines (should be "." and "..", these can be deleted by hitting "d" twice, followed by shift-colon, at the colon prompt enter this sequence:

%s/^/mv /g

enter after that, simply change the second colum to have lower case jpg at the end. escape back to shell and save by hitting escape shift-colon and at the prompt enter:

wq!

at the prompt execute:

sh shit

I would explain how to do it for all files etc... but that's getting a bit tricky and wouldnt want to do so without seeing the file structure myself. be careful!

Nice sledgehammer for a little nut

chodadog 02-06-2004 09:24 AM

Quote:

Originally posted by directfiesta
Why dont you just delete the files you uploaded. Then, on your pc, do a batch rename of the extension with Namewiz or any other renaming proggie. Then re-upload the shit.

Much safer than going in " shell" by telnet....

Or if not too many, use an FTP like shell manager:

F-Securee SSH file transfer. If interested, could post the link...

Just didn't want to have to re-upload everrrrrrrrrything. But i just realised my FTP program has a setting that will only upload the new files. ooh. Thanks for the help anyways.

com 02-06-2004 10:39 AM

Quote:

Originally posted by blazin


Nice sledgehammer for a little nut

depends on how you look at it... for me unix power tools are second nature... takes me less then a minute to accomplish what I need. How would you go about it :)


All times are GMT -7. The time now is 09:45 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123