Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-06-2004, 06:29 AM   #1
chodadog
Confirmed User
 
Join Date: Apr 2002
Posts: 9,736
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.
__________________
26 + 6 = 1
chodadog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 06:32 AM   #2
broke
Confirmed User
 
Join Date: Aug 2003
Location: Someplace Windy
Posts: 4,501
What OS?
__________________
Perfect Gonzo
broke is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 06:35 AM   #3
keyDet79
Confirmed User
 
Join Date: Feb 2003
Location: Netherlands
Posts: 1,109
mv in nix, ren in win
__________________

Multihomed quality BW for less
ICQ 51034232 - MSN [email protected] - Email keydet(at)vibehosting.com
keyDet79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 06:35 AM   #4
chodadog
Confirmed User
 
Join Date: Apr 2002
Posts: 9,736
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.
__________________
26 + 6 = 1
chodadog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 06:37 AM   #5
com
Confirmed User
 
Join Date: Aug 2003
Location: Portland, Oregon
Posts: 4,541
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!
__________________

Real. Professional. Hosting.
.:Expect Nothing Less:.
320-078-843 :: www.realprohosting.com :: [email protected]
com is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 06:37 AM   #6
Weppel
Confirmed User
 
Join Date: Aug 2003
Location: Netherlands
Posts: 2,190
Could be done by a simple shellscript, or a php script, whatever you want ;)
Weppel is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 06:40 AM   #7
chodadog
Confirmed User
 
Join Date: Apr 2002
Posts: 9,736
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.
__________________
26 + 6 = 1
chodadog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 07:07 AM   #8
directfiesta
Too lazy to set a custom title
 
directfiesta's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Montreal, Quebec
Posts: 29,680
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...
__________________
I know that Asspimple is stoopid ... As he says, it is a FACT !

But I can't figure out how he can breathe or type , at the same time ....
directfiesta is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 07:25 AM   #9
com
Confirmed User
 
Join Date: Aug 2003
Location: Portland, Oregon
Posts: 4,541
regular expressions own!
I've always wished that this was syntactically correct:

# mv *.WHATEVER *.whatever

hehe
__________________

Real. Professional. Hosting.
.:Expect Nothing Less:.
320-078-843 :: www.realprohosting.com :: [email protected]
com is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 09:15 AM   #10
blazin
Confirmed User
 
Join Date: Aug 2002
Posts: 2,781
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
blazin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 09:24 AM   #11
chodadog
Confirmed User
 
Join Date: Apr 2002
Posts: 9,736
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.
__________________
26 + 6 = 1
chodadog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 10:39 AM   #12
com
Confirmed User
 
Join Date: Aug 2003
Location: Portland, Oregon
Posts: 4,541
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
__________________

Real. Professional. Hosting.
.:Expect Nothing Less:.
320-078-843 :: www.realprohosting.com :: [email protected]
com is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.