LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-26-2010, 11:06 AM   #1
danielldf
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Rep: Reputation: 0
Spliting 15000 images in sub-folders?


Hello! =]

I have a folder with 15000+ images! Any ideas of how to (using bash) mv the files to sub-folders a/ b/ c/ d/ e/ f/ g/ h/ i/ j/ ?

thankz
 
Old 12-26-2010, 11:09 AM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
How do you plan on deciding which files go into which directory?
 
Old 12-26-2010, 11:10 AM   #3
danielldf
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
doesnt make difference for me! =]
 
Old 12-26-2010, 11:56 AM   #4
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
Homework?
 
Old 12-26-2010, 12:36 PM   #5
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
The target directories are all letters of the alphabet. You could take the first letter of each file name and assign it to the corresponding directory.

However this would only work well if the file names' first letters were evenly distributed over the alphabet. In other words if all of the file names were IMGxxxx.jpg then taking the first letter of the file name as the target directory would put all of the files in the "i" directory. That would not be any better than leaving them where they are.

In a case like that you would want to use a characteristic that would split up the files more evenly. Using the creation date would be nice if it were available, but it isn't. Using the last modification date might be a good choice if the images were created over a long period of time and only a few would match any particular date. Of course that could lead to the other problem of having only one picture per target directory and that is no better than leaving them all in one directory. It might even be worse because they would be tedious to access in a file viewer.

Since we don't know anything about the files then you will have to determine some sorting criteria that will lead to a useful result.

Last edited by stress_junkie; 12-26-2010 at 12:50 PM.
 
Old 12-26-2010, 04:28 PM   #6
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by phil.d.g View Post
Homework?
+1
I was thinking the same thing.
 
Old 12-27-2010, 09:59 AM   #7
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Quote:
Originally Posted by andrewthomas View Post
+1
I was thinking the same thing.
So what if it is? We can help someone analyze the problem. We can even help them to develop a script. The only thing that I don't respect is handing a developed solution to the person with no effort on their part. There is no evidence that the OP wants that.

Last edited by stress_junkie; 12-27-2010 at 10:07 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrade Redhat 9 to Fedora 10 on Dell Poweredge 15000 Rack Server jmzcons Linux - Newbie 1 05-30-2009 02:15 AM
Very Poor Disk Performance SAS 15000 RPM Drives JustinK101 Linux - Newbie 4 07-02-2008 08:57 PM
Can't be booted after spliting a partition into 2 wlaw Linux - Newbie 2 10-04-2006 09:31 PM
Spliting files th3gh05t Linux - Newbie 11 09-15-2006 05:46 AM
"Folders with custom images" possible in KDE? SuperJar Linux - Software 2 11-30-2005 08:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration