Fedora Linux Support Community & Resources Center
  #1  
Old 26th December 2010, 11:24 PM
s3cur17y Offline
Registered User
 
Join Date: Aug 2005
Location: Springfield, Oh
Age: 32
Posts: 66
linuxchrome
Mass rename, folder creation, and move.

Hello, I was wondering if someone would have a script that would recursively check a folder for avi files and rename them by the folder they are in and then create a new folder in the parent directory and move the avi there.
__________________
HP DV6000 Dual boo Windows 7 Ultimate, and F13
EeePc 900a 16GB SSD, 1GB Ram, F13 Quasar8000 Custom EeePc Kernel
Reply With Quote
  #2  
Old 28th December 2010, 03:23 PM
aesir Offline
Registered User
 
Join Date: Nov 2008
Location: ~
Age: 28
Posts: 175
linuxopera
Re: Mass rename, folder creation, and move..

This would do most of the job
Code:
find ./ -name '*.avi' | while read i; do 
 j=`expr "$i" : ".*\/\(.*\)\/.*\.avi"`
 new="destdir/$j.avi"
 [ ! -e "$new" ] && ln "$i" "$new"
done
Change destdir to where you want to move the file, and "ln" to "mv" if you want to remove the original.
If you want to keep it simple destdir should be outside the current directory.
Reply With Quote
  #3  
Old 28th December 2010, 08:37 PM
s3cur17y Offline
Registered User
 
Join Date: Aug 2005
Location: Springfield, Oh
Age: 32
Posts: 66
linuxchrome
Re: Mass rename, folder creation, and move..

Thank you for your help...
__________________
HP DV6000 Dual boo Windows 7 Ultimate, and F13
EeePc 900a 16GB SSD, 1GB Ram, F13 Quasar8000 Custom EeePc Kernel
Reply With Quote
Reply

Tags
creation, folder, mass, rename

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mass rename of files sidebrnz Using Fedora 4 2nd July 2010 08:00 AM
A question about ln command for link creation to a folder on windows partition dariyoosh Using Fedora 3 16th January 2010 07:15 PM
Rename JPG Files to Creation Date LastLink Using Fedora 4 3rd September 2009 01:53 AM
how to move a folder local/lib bayareasm Using Fedora 2 16th November 2008 02:38 PM
Folder creation apparition Using Fedora 2 5th February 2007 11:20 PM


Current GMT-time: 02:26 (Saturday, 30-08-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat