Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Clean your desktop!

Code
import os

desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
clean_folder = 'Shit'

def clean(from_dir, spec_dir):
   for file in os.listdir(from_dir):
       if not '.lnk' in file and file != clean_folder:
           try:
               os.rename(from_dir + '\\' + file, spec_dir + '\\' + file)
           except:
               pass

def fu_clean():
   curr_dir = os.getcwd()
   os.chdir(desktop)
   clean(desktop, desktop + '\\' + clean_folder)
   os.chdir(curr_dir)

if not clean_folder in os.listdir(desktop):
   os.mkdir(desktop + '\\' + clean_folder)

fu_clean()
*Github Link*

This code makes a folder on your desktop with all the files and folder that are currently on your desktop, except for the shortcuts!
Perfect for keeping your computer organized!
i just tried it out and it worked!
thank you so much for this share :)
Awesome, saved to my python_utils folder!
This will only work on windows, for us Linux folk the desktop folder is ~/Desktop
¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´
(Oct 28, 2017 02:27 AM)vorticalbox Wrote:  This will only work on windows, for us Linux folk the desktop folder is ~/Desktop

Oh yeah, should have said that! But feel free to edit the code!
(Oct 28, 2017 02:56 AM)inv3ctus Wrote:  Oh yeah, should have said that! But feel free to edit the code!

totally would but currently doing a coding challenge for a job in node.js. only started learning it last week and man this shit is confusing, EVERYTHING is async and you have to be so carful when processing stuff lol
¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by W R TJan 19, 2014 12:57 PM 4 283 Jan 19, 2014 12:57 PM
Last Post: W R T
[.NET] by TemploitJan 2, 2013 04:38 AM 7 610 Jan 2, 2013 04:38 AM
Last Post: Temploit
[.NET] by Ekin0x_Aug 18, 2012 04:19 PM 21 963 Aug 18, 2012 04:19 PM
Last Post: CakePHP