Whenever you have 10k picture to look through in one directory you know it takes forever to load those thumbnails.
And to find that perfect picture from Christmas 2000 it takes forever.
Wouldn't it be nice to just go to the folder 200012 and see all the pictures you made in december of the year 2000.
Well with a few commands you can actually do this real quickly.
First of all , if you already have somekind of folder structure you might move or copy everything to one root folder.
Here is the "flattening" command for e.g. all jpg files
find . -name "*.JPG" -print0 | xargs -0 cp --target-directory ./test/
After you flattenend your directory
lets create the date folders:
mkdir `ls -l --time-style=+"%Y%m" | awk '{print $6}' | sort | uniq`
So after this step move all the files to there correct folder:
For this step I couldn't get it without a script
So I made this little bash script which uses rather cool features of bash:
#!/bin/bash
IFS=$'\n'
a=`ls -l --time-style=+"%Y%m" | awk '/^-/{print "mv "$7 " ./"$6"/"$7}'`
for i in $a
do
echo $i
eval $i
done;
And to find that perfect picture from Christmas 2000 it takes forever.
Wouldn't it be nice to just go to the folder 200012 and see all the pictures you made in december of the year 2000.
Well with a few commands you can actually do this real quickly.
First of all , if you already have somekind of folder structure you might move or copy everything to one root folder.
Here is the "flattening" command for e.g. all jpg files
find . -name "*.JPG" -print0 | xargs -0 cp --target-directory ./test/
After you flattenend your directory
lets create the date folders:
mkdir `ls -l --time-style=+"%Y%m" | awk '{print $6}' | sort | uniq`
So after this step move all the files to there correct folder:
For this step I couldn't get it without a script
So I made this little bash script which uses rather cool features of bash:
#!/bin/bash
IFS=$'\n'
a=`ls -l --time-style=+"%Y%m" | awk '/^-/{print "mv "$7 " ./"$6"/"$7}'`
for i in $a
do
echo $i
eval $i
done;
Reacties
Een reactie posten