Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i'm using Ubuntu && MAC OS/X. i'm trying to achive a random order in finder or nautilus.

someone can get me some advice? i am open to any kind of solutions, shell script or applescript, whatever, but i think there would be something easier.

till now i have renamed files with random names and order it alphabetically but i'm looking for something that does preserve the real names.

share|improve this question
1  
Do you just want a list of the file names in random order or do you need nautilus/finder to display them this way graphically? Also, define random. Do you need true, mathematically rigorous randomness or just any non-alphabetic order? –  terdon Oct 23 '12 at 12:52
    
i need nautilus/finder to display them in random way graphically. i doen not need a super secure random math definition. what all programming language use it is ok (in python from random import random). non-alphabeti, non-lastmodification, non-size order. –  nkint Oct 23 '12 at 14:36
add comment

2 Answers

up vote 3 down vote accepted

If you need a graphical file manager to sort the files randomly you will probably HAVE to change the file names. File managers are just not made for this kind of functionality. To "preserve" the file names you could just create links with random names in a new directory that link back to the originals:

find . -type f | while read n; do \
     ln -s `pwd`/"$n" new_dir/`head /dev/urandom | tr -dc A-Za-z | head -c8`; \
done
share|improve this answer
add comment

You could also modify some other attributes like modification dates.

do shell script "for f in ~/Desktop/*; do
touch -t $(($RANDOM % 8000 + 2000))01010000 \"$f\"
done"
tell application "Finder"
    open (desktop as alias)
    tell Finder window 1
        set current view to list view
        set sort column of its list view options to modification date column
    end tell
end tell

Finder doesn't see comments added by xattr -w com.apple.metadata:kMDItemFinderComment. I don't know any way to set the versions of files.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.