How to open a random folder within a directory
>>> import random >>> import os >>> files = os.listdir('/tmp') >>> dirs = [f for f in files if os.path.isdir(f)] >>> random.sample(dirs,1) ['tempdir']
Related videos on Youtube
04 : 25
How to Fix Ubuntu Linux Freezing on Boot
07 : 01
How To Clean And Speed Up Ubuntu
00 : 51
How To Fix Shutdown Freezing Problem In Ubuntu Linux
02 : 17
Freeze Fix: Console Mode - Ubuntu 12.04
03 : 29
Fix freeze after suspend on ubuntu gnome/GDM (Nvidia only) [could be outdated, please back up first]
Sunny Shah 9 minutes
I was wondering how I would use a batch file or Python to open a random folder from a selection of many folders within a directory?
Tinellus over 10 yearsYou should be able to elegantly reboot your system by pressing Alt - SysRq (both at the same time) and combine with these, one after the other: r e i s u b (aka the magic SysRq key en.wikipedia.org/wiki/Magic_SysRq_key). Could you report back if this works for you or not? You could also check in var/log/syslog and var/log/kern.log (open the log files in gedit) if something out of the ordinary has happened at the time of the freeze/lockup. If there is something, copy the relevant messages to pastebin.com and post the link in your question.
Bruno Pereira over 10 yearsYou should report this issue as a bug in launchpad.net, they will guide you and help you sort out if there is another bug already open with it.
artfulrobot over 10 years@Tinellus Will try the magic SysRq thing on my box that has a SysRq button (the laptop doesn't). There is nothing in syslog, guess it doesn't have time to write it. @Bruno i guess you mean
jpetersen over 10 yearsif you have a "Print Screen" button you can use Ctrl + Alt + PrtScrn....just incase you were overlooking that key on your laptop
artfulrobot over 10 yearsThanks, not had much success with that in the past, perhaps I'm running out of fingers!. Will report back when I crash it today.
artfulrobot over 10 yearsYep, unresponsive to Alt-SysRq.
vchyzhevskyi over 9 years1) get list of all folder within a directory 2) random.choice(<list of folders>) 3) open directory 4) PROFIT!
bereal over 9 yearsFirst of all, what do you mean by opening a folder?
Sunny Shah over 9 yearsSorry I meant a batch file
MattDMo over 9 years@coirius - really? It should be 4) ... 5) PROFIT! The "..." is the most important step of all!
artfulrobot about 10 yearsinteresting! I do use Chromium sometimes. However, have def. had freezes without it.
artfulrobot about 10 yearsah, shucks, back again. filed bug
Python: can't open file 'setup.py': [Errno 2] No such file or directory. Directory Change does not remove error
How to generate random pairs of numbers in Python, including pairs with one entry being the same and excluding pairs with both entries being the same?