HxC Floppy Drive Emulator

HxC Floppy Drive Emulator general information and news
It is currently Thu May 23, 2013 7:36 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Linux: sorting files on SD card
PostPosted: Wed May 30, 2012 6:39 pm 
Offline

Joined: Sun Oct 22, 2006 10:32 pm
Posts: 12
Hi there,

If you are running Linux here is a little script to sort recursively your files on your SD card (of course it also works with any storage):

Code:
#!/bin/sh

# Usage:
# findalpha [-R]

# Reorder the directory entries according to alphanumerical order, so
# find output is in order.  Useful for preparing files for play on an
# MP3 player that follows directory order.
# If -R is given, do recursively.

# Thu Dec 27 02:47:00 EST 2007 v. 0.1 jh initial version
# Wed Oct 22 11:08:00 EST 2008 v. 0.2 andrew-regner added support for directories with spaces

# TODO:
# figure out why it works on IDE but not on USB, even if the FS is ext3

start="`pwd`"

if [ "$1" = "-R" ] ; then
  dirs=`find . -type d`
else
  dirs=.
fi

for dir in $dirs; do
  test "$sdir" != "" && dir="$sdir $dir"
  if [ ! -d "$dir" ]; then
    sdir="$dir"
    continue
  fi
  cd "$dir"
  tmp=`mktemp -d -p .`
  find . -maxdepth 1 -mindepth 1 | grep -v $tmp | xargs -n1 -d"\n" -I'{}' mv '{}' $tmp
  cd $tmp
  find . -maxdepth 1 -mindepth 1 | sort -n | xargs -n1 -d"\n" -I'{}' mv '{}' ..
  cd ..
  rmdir $tmp
  cd "$start"
done


Save it (as root if necessary) for example in /usr/bin/findalpha

Usage is quite simple: open a terminal, change the current directory to the one you want to sort. Then just type "findalpha". Or type "findalpha -R" to sort recursively.
Example:
Code:
~$ cd /media/HXC/
/media/HXC$ findalpha -R


Information was taken from this site: http://www.linuxforums.org/forum/newbie/111044-change-order-files-directory.html-R


Top
 Profile  
 
 Post subject: Re: Linux: sorting files on SD card
PostPosted: Thu May 31, 2012 6:03 pm 
Offline

Joined: Sun Mar 20, 2011 6:55 pm
Posts: 131
Code:
apt-get install fatsort


[url]
http://fatsort.sourceforge.net/
[/url]


Top
 Profile  
 
 Post subject: Re: Linux: sorting files on SD card
PostPosted: Thu May 31, 2012 11:55 pm 
Offline

Joined: Sun Oct 22, 2006 10:32 pm
Posts: 12
Oh thanks, I didn't know this is one existed :oops:


Top
 Profile  
 
 Post subject: Re: Linux: sorting files on SD card
PostPosted: Thu Sep 20, 2012 1:32 am 
Offline

Joined: Wed Sep 19, 2012 10:50 pm
Posts: 1
Location: saint-malo
Bonjour à tous je suis nouveau sur ce forum "désolé je n'est pas trouvé la section de présentation".
Je suis moi même sous linux ( ubuntu 11.04 ) j'ai constaté que le soft fonctionne très bien sous WINE que l'on trouve dans la logithèque ou via la console " apt-get install WINE " enfin bon , de ce côté la je ne vous apprends rien. J'ai pu sans mal convertir mes fichiers DSK en HFE pour mon CPC 6128 . bonne fin de semaine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 2 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group