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 01-31-2012, 11:36 AM   #1
Just Alex
Liv Benson to You, Bitch
 
Just Alex's Avatar
 
Industry Role:
Join Date: Aug 2007
Location: Maryland and WV
Posts: 6,060
Unix gurus, how do you batch rename multiple folders

Lets say I have them 001, 002, 003 .. etc.. How can I rename them 200,201,202 or just do 1-001, 1-002, 1-003

Anyone knows a command or script?
__________________
Just Alex is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-31-2012, 11:49 AM   #2
MaDalton
I am Amazing Content!
 
MaDalton's Avatar
 
Industry Role:
Join Date: Feb 2004
Posts: 39,823
i use total commander via ftp
MaDalton is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-31-2012, 11:51 AM   #3
gleem
Confirmed User
 
gleem's Avatar
 
Industry Role:
Join Date: Jun 2001
Location: Sunny Land
Posts: 5,593
I used this to rename extensions, should work on folders too:

http://lab.artlung.com/unix-batch-file-rename/

just replace the "00" part with "200"
__________________




Contact me: \\// E: webmaster /at/ unprofessional.com
gleem is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-31-2012, 11:56 AM   #4
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
Check out "man rename". An example

rename 'foo' 'bar' dir*

dir_foo1/ becomes dir_bar1/
dir_foo2/ becomes dir_bar2/

Quote:
Originally Posted by Just Alex View Post
Lets say I have them 001, 002, 003 .. etc.. How can I rename them ... 1-001, 1-002, 1-003
For that specifically:
rename "" "1-" 0*

Last edited by raymor; 01-31-2012 at 12:00 PM..
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-31-2012, 12:48 PM   #5
Just Alex
Liv Benson to You, Bitch
 
Just Alex's Avatar
 
Industry Role:
Join Date: Aug 2007
Location: Maryland and WV
Posts: 6,060
Thanks guys
__________________
Just Alex is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-31-2012, 01:13 PM   #6
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,225
if you wanted to renaming inside the folders for say imagesr like akjs.jpg bigpacks.jpg etc and rename them to 1.jpg 2.jpg 3.jpg.

Code:
#!/bin/bash

i=1; 
shopt -s nullglob; 

for f in *.{jpg,jpeg,JPG,JPEG,gif,GIF,png,PNG}; do     
	ext="${f##*.}"; 
	ext=${ext,,}; 
	ext=${ext/jpeg/jpg};     
	mv -- "$f" "newfolder/$i.${ext}";     
	((i++)); 
done
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is online now   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.