![]() |
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.
|
What OS?
|
mv in nix, ren in win
|
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.
|
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! |
Could be done by a simple shellscript, or a php script, whatever you want ;)
|
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.
|
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... |
regular expressions own!
I've always wished that this was syntactically correct: # mv *.WHATEVER *.whatever hehe |
Quote:
|
Quote:
|
Quote:
|
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