Tidy -- simple python script to clean annoying files and directories

Hi all,
recently I opened a much-used flash drive and there was a lot of files like Thumbs.db, Mac OS' ._*, .DS_Store, etc all over it, making using it really annoying.
So I decided to mimic a simple utility I saw as a plugin in Rockbox, which takes all of these files and deletes them.
The result is a simple python script which you can find at:
http://github.com/houbysoft/short/blob/master/tidy
Usage should be self-explanatory. Be warned, by default, it deletes everything that matches the regular expressions without warning (this should be fine though, so if you want to be safe, try the -s and -v (simulate, verbose) or -p (prompt) options first.
As usual, any feedback is welcome, and if you know of other files it should clean, please post them here!

Hi all,
recently I opened a much-used flash drive and there was a lot of files like Thumbs.db, Mac OS' ._*, .DS_Store, etc all over it, making using it really annoying.
So I decided to mimic a simple utility I saw as a plugin in Rockbox, which takes all of these files and deletes them.
The result is a simple python script which you can find at:
http://github.com/houbysoft/short/blob/master/tidy
Usage should be self-explanatory. Be warned, by default, it deletes everything that matches the regular expressions without warning (this should be fine though, so if you want to be safe, try the -s and -v (simulate, verbose) or -p (prompt) options first.
As usual, any feedback is welcome, and if you know of other files it should clean, please post them here!

Similar Messages

  • Omodoro - simple python script to use the pomodoro technique

    Hello everyone,
    did you ever have the feeling that your productivity is not high enough?
    That you're wasting too much time on reddit, facebook, youtube or <insert-online-community-here>?
    Maybe you should try the pomodoro technique! It keeps you focused on important tasks, lets you set goals to achieve and also makes sure that you take breaks to regain energy.
    I wrote a simple python script to work with the pomodoro technique. It's called omodoro. It displays reminders and ensures that you do your tasks but also take your breaks.
    Maybe anyone of you wants to try it out and provide feedback - it would be appreciated!
    It's available on github: omodoro
    There's also a PKGBUILD in the AUR:
    https://aur.archlinux.org/packages/omodoro-git/
    I hope, you like it!
    Greetings,
    Oliver
    Last edited by okraits (2014-02-11 22:17:54)

    I've always wanted to try the pomodoro technique out but never actually have. I guess this is my excuse to do it. Looks like a nice little script; I'll check it out when I get the chance.

  • I have a 2009 MB Pro. I have been trying to do some cleaning of files and discovered that in Finder, All Images, I am experiencing a frustrating problem. I spent a few hours trashing over 4K images and within a few hours, I had as many more. Help!

    I have a 2009 MB Pro. I have been trying to do some cleaning of files and discovered that in Finder, All Images, I am experiencing a frustrating problem. I spent a few hours trashing over 4K images and within a few hours, I had as many more.  I did a couple of thousand trashed images and half hour later, more arrived. There are a lot of images that seem off the internet, including gif.s, png.s. Help!

    First, back up all data immediately, as your boot drive might be failing.
    There are a few other possible causes of generalized slow performance that you can rule out easily.
    Reset the System Management Controller.
    If you have many image or video files on the Desktop with preview icons, move them to another folder.
    If applicable, uncheck all boxes in the iCloud preference pane.
    Disconnect all non-essential wired peripherals and remove aftermarket expansion cards, if any.
    Check your keychains in Keychain Access for excessively duplicated items.
    If you have more than one user account, you must be logged in as an administrator to carry out this step.
    Launch the Console application in the same way you launched Activity Monitor. Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Select the 50 or so most recent entries in the log. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V). You're looking for entries at the end of the log, not at the beginning.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some personal information, such as your name, may appear in the log. Anonymize before posting. That should be easy to do if your extract is not too long.

  • I have added photos to a portfolio website I'm building and a lot of them look VERY grainy when you click on them. They are nice clean large files and can print bat high res way over 16" x 20" so whats happened to them in iWeb?

    I have added photos to a portfolio website I'm building and a lot of them look VERY grainy when you click on them. They are nice clean large files and can print bat high res way over 16" x 20" so whats happened to them in iWeb?

    When you are dealing with websites, image file size is a trade off between quality and download speed. There's not a lot of point to having high quality images if they take too long to download in the browser.
    Nowadays we also have to consider the device that the end user is viewing the images on. An image that is optimized for viewing on a large screen is total overkill and unsuitable for those using mobile devices.
    Really we should be supplying different versions of media files for different devices using @media rules in the stylesheet but this is rather outside of the scope of iWeb. If you use the built in image optimizer and the iWeb Photo template with slideshow, the application will optimize the images according to the way in which you set this function in preferences and the slideshow size will be automatically reduced for those viewing it on smaller screens.
    If you want to give your viewers the opportunity to view large, high quality images, you can supply them as a download.

  • [SOLVED] Check for old configuration files and directories in ~/

    Hello,
    Since I started with Arch I tried and uninstalled a few programs and would like to check for possible left overs in ~/
    I tried the "lostfiles" script, but it does not seem to check the home directory. Then I followed this: https://wiki.archlinux.org/index.php/Pa … ny_package - But using the suggested alias in my bash, it gives me the below:
    $ pacman-disowned-files
    [sudo] password for [my user]:
    bash: -path: command not found
    bash: /root: Is a directory
    bash: -print: command not found
    What am I doing wrong?
    Regards
    Martin
    Last edited by onslow77 (2015-02-04 23:52:44)

    Hello,
    ohh, I see, I need to do this (in directory where I put the script)
    sh pacman-disowned -files > test.txt
    That solved the usage of the commands, but it does not however list files [in the test.txt file] that do not belong to any package in my ~/ directory (I put a dummy file in my ~/ to see if it got noticed) - but it did not. So how can I list files and directories in my ~/ directory that is not put there by any package that currently is installed?
    Regards
    Martin
    Last edited by onslow77 (2015-02-04 22:49:11)

  • DeployTool deletes files and directories

    Hi All,
    I have been facing serious issues with the DeployTool, once on Windows 2003 and the other on Solaris 9.
    On Windows 2003, while I was trying to deploy an EAR file using the DeployTool, the deployment failed. And it then subsequently not only deleted the WebAS files and directories but also the system files. I had to reformat the system and install WebAS 6.40 SP9 again on it.
    Now on Solaris 9 (with WebAS 6.40 SP9), when I was undeploying an application using the DeployTool, then again it deleted some directories in the user home directories, including the user and WebAS profile and environment scripts. M still to get the system back in place.
    Is this a known issue with the DeployTool and if yes what wud be the recommended way to proceed in either case?
    regards,
    Vishal

    You probably should rename the files.
    A * is specifically not allowed in a file name. What's happening is that the file is stored with the unicode representation of the character. Unicode-aware apps like the Finder can deal with this but most other apps (including the file sharing daemons) cannot and that's why you see the unusual file names.
    You're going to run into all kinds of other problems, too. Renaming your files i the best bet.

  • I have an external hard drive that was formatted by a PC and has files and directories etc. I want to format it and use it on my IMAC for backup but I can't seem to write to it nor can I delete current content. How do I initialize it for use with the MAC?

    I have an external hard drive that was formatted by a PC and has files and directories copied to it etc. I want to use it on my IMAC for backup. I see it on my my IMAC . I can open files etc.  But I can't seem to write to it nor can I delete current content. I don't care if I lose current content. How do I initialize it for use with the MAC?

    You can't write to it because it's formatted as NTFS which OS X will read but not write to. If you want to continue using the drive with both a PC and OS X you will need to download and install NTFS-3G so you can then write to it from your Mac. You can get NTFS-3G at:
    http://www.macupdate.com/app/mac/24481/ntfs-3g
    If you want to use the drive exclusively with your Mac then move the data off it and reformat it in Disk Utility (Applications - Utilities - Disk Utilities) as Mac OS Extended (Journaled.)

  • How to select  file and directories to ZIP

    HI,
    I'm doing an application that would zip a file and directories. here's an exmple:
    fileName = FileNameTest.csv
    folderName = FileNameTest_A
    folderName = FileNameTest_B
    The foldername is taken from the fileName with "_A" and "_B" at the end. The file and directories are located in a directory where there can also be other files and directories in it. What I want to do is to zip only the above file and directories.
    Any help will be greatly appreciated!
    Thanks!

    Not a very clear specification. What do you want the resulting zip entries/files/paths to look like?

  • File Chooser is displaying names of the Files and Directories as boxes

    Hi All,
    Actually i am working on an application in which i have the requirement to internationalize the File Chooser in All Operating Systems. The application is working properly for all languages on MAC OS, but not working properly for the language Telugu on both the Ubuntu and Windows OS. The main problem is, when i try to open the File Chooser after setting the language to TELUGU all the labels and buttons in the File Chooser are properly internationalized but names of Files and directories in the File Chooser are displaying as boxes.
    So please provide your suggestions to me.
    Thanks in Advance
    Uday.

    I hope this can help you:
    package it.test
    import java.awt.BorderLayout;
    import java.awt.Frame;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Locale;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    * @author Alessandro
    public class Test extends JDialog {
         private JFileChooser fc = null;
         private Frame bfcParent = null;
         public Test(Frame parent, boolean modal) {
              super(parent, modal);
              this.bfcParent = parent;
              if (fc == null) {
                   fc = new JFileChooser();
                   fc.setAcceptAllFileFilterUsed(false);
                   fc.setLocale(Locale.ITALIAN);//i think you should use english
                   //these are in telugu
                   UIManager.put("FileChooser.openDialogTitleText", "Open Dialog");
                   UIManager.put("FileChooser.saveDialogTitleText", "Save Dialog");
                   UIManager.put("FileChooser.lookInLabelText", "LookIn");
                   UIManager.put("FileChooser.saveInLabelText", "SaveIn");
                   UIManager.put("FileChooser.upFolderToolTipText", "UpFolder");
                   UIManager.put("FileChooser.homeFolderToolTipText", "HomeFolder");
                   UIManager.put("FileChooser.newFolderToolTipText", "New FOlder");
                   UIManager.put("FileChooser.listViewButtonToolTipText", "View");
                   UIManager.put("FileChooser.detailsViewButtonToolTipText", "Details");
                   UIManager.put("FileChooser.fileNameHeaderText", "Name");
                   UIManager.put("FileChooser.fileSizeHeaderText", "Size");
                   UIManager.put("FileChooser.fileTypeHeaderText", "Type");
                   UIManager.put("FileChooser.fileDateHeaderText", "Date");
                   UIManager.put("FileChooser.fileAttrHeaderText", "Attr");
                   UIManager.put("FileChooser.fileNameLabelText", "Label");
                   UIManager.put("FileChooser.filesOfTypeLabelText", "filesOfType");
                   UIManager.put("FileChooser.openButtonText", "Open");
                   UIManager.put("FileChooser.openButtonToolTipText", "Open");
                   UIManager.put("FileChooser.saveButtonText", "Save");
                   UIManager.put("FileChooser.saveButtonToolTipText", "Save");
                   UIManager.put("FileChooser.directoryOpenButtonText", "Open Directory");
                   UIManager.put("FileChooser.directoryOpenButtonToolTipText", "Open Directory");
                   UIManager.put("FileChooser.cancelButtonText", "Cancel");
                   UIManager.put("FileChooser.cancelButtonToolTipText", "Cancel");
                   UIManager.put("FileChooser.newFolderErrorText", "newFolder");
                   UIManager.put("FileChooser.acceptAllFileFilterText", "Accept");
                   fc.updateUI();
         public int openFileChooser() {
              fc.setDialogTitle("Open File");
              fc.resetChoosableFileFilters();
              int returnVal = 0;
              fc.setDialogType(JFileChooser.OPEN_DIALOG);
              returnVal = fc.showDialog(this.bfcParent, "Apri File");
              //Process the results.
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                   System.out.println("Hai scelto di aprire un file");
              } else {
                   System.out.println("hai annullato l'apertura");
              return returnVal;
         private static void createAndShowGUI() {
              JFrame frame = new JFrame("FileChooser");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JPanel jp = new JPanel(new BorderLayout());
              JButton openButton = new JButton("Open File");
              final Test test = new Test(frame, true);
              openButton.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e) {
                        test.openFileChooser();
              openButton.setEnabled(true);
              jp.add(openButton, BorderLayout.AFTER_LAST_LINE);
              //Add content to the window.
              frame.add(jp);
              //Display the window.
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args) {
              //Schedule a job for the event dispatch thread:
              //creating and showing this application's GUI.
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        //Turn off metal's use of bold fonts
                        createAndShowGUI();
    }bye ale

  • Traversing files and directories underneath a directory

    I'm looking at some sample code about traversing files and directories underneath a directory. I'm trying to understand exactly what the code is doing. I see that dir.list() is building a string array of filenames and directory names. Then it tests each to see whether it's a directory. If it's a directory then is looks and each file and or directory in that directory.
    But I don't understand how it keeps going below just the second level directory. The two lines of code I'm not sure I understand are:
    1) process(dir);
    2) visitAllDirsAndFiles(new File(dir, children));
    Can anyone help me to understand exactly how this code block can traverse beyond just the second directory level?
    // Process all files and directories under dir
        public static void visitAllDirsAndFiles(File dir) {
            process(dir);
            if (dir.isDirectory()) {
                String[] children = dir.list();
                for (int i=0; i<children.length; i++) {
                    visitAllDirsAndFiles(new File(dir, children));

    No, I guess they might be assuming somethings. Here is the page with the sample code:
    [http://exampledepot.com/egs/java.io/TraverseTree.html]

  • How to bundle all files and directories in a package?

    how to bundle all files and directories in a package?
    i plan to put all image files, .class files and some other files together.and then double click the package to execute the program.
    should i use jar?is there a link for tutorial or example?
    thanks in advance

    http://java.sun.com/docs/books/tutorial/jar/

  • What files and directories are shipped with the Oracle Agent ?

    Hi:
    - Could someone please outline the intent of all the files
    and directories that are shipped with the Oracle agent?
    - I think this was documented somewhere but I cannot
    recall where I saw this previously.
    - Another question: if I wanted to add a logfile for my plug-in
    (for debugging/troubleshooting)
    under which directory should this logfile be placed ?
    Thanks
    John

    http://download.oracle.com/docs/cd/B19306_01/em.102/b40002/structure.htm#i1028189 should help you understand the directory structure of OEM Agent.

  • Listing Files and Directories

    On our internal web page we have some links to various areas
    like Office Forms, Safety, etc... The supervisors that maintain
    these documents have access to shares that allow them add, remove,
    and update the files as needed. Since the content in each changes
    fairly often we're currently using CFDIRECTORY with the LIST action
    to display the contents to the users on the web page.
    Some of the areas now contain quite a few documents and the
    supervisors would like to be able to group their documents in
    subdirectories. I know I can I can use RECURSE="yes" to have the
    web page list the contents of these folders, but the supervisors
    would like the end users to see the subdirectories as well so
    things are less confusing and cluttered on both ends.
    So is there any way in CF to set up these pages so that
    subdirectories can can be navigated and the documents selected? If
    possible, I'd like something that can handle this dynamically so
    that I don't have to constantly change the code every time a
    supervisor decides to add/remove a directory.
    We're currently running CF8 Standard.
    Thanks!

    Vidikron wrote:
    > On our internal web page we have some links to various
    areas like Office Forms,
    > Safety, etc... The supervisors that maintain these
    documents have access to
    > shares that allow them add, remove, and update the files
    as needed. Since the
    > content in each changes fairly often we're currently
    using CFDIRECTORY with the
    > LIST action to display the contents to the users on the
    web page.
    >
    > Some of the areas now contain quite a few documents and
    the supervisors would
    > like to be able to group their documents in
    subdirectories. I know I can I can
    > use RECURSE="yes" to have the web page list the contents
    of these folders, but
    > the supervisors would like the end users to see the
    subdirectories as well so
    > things are less confusing and cluttered on both ends.
    >
    > So is there any way in CF to set up these pages so that
    subdirectories can can
    > be navigated and the documents selected? If possible,
    I'd like something that
    > can handle this dynamically so that I don't have to
    constantly change the code
    > every time a supervisor decides to add/remove a
    directory.
    >
    > We're currently running CF8 Standard.
    >
    > Thanks!
    >
    Pretty much what you got should do it. The simplest change
    would be to
    output entire directory structure on your current page, just
    nesting the
    files and directories.
    I would just create a looping output that uses the fields of
    the record
    set to output the directories and the files with-in them
    probably as a
    nested set of <ul> unordered lists.
    If you want to break up this user interface into distinct
    units which
    only list the contents of a current directory then just do
    the output as
    you have it without using recursion. But make the
    sub-directory
    listings links that when clicked repopulate the current page
    listing the
    contents of the selected directory.
    Neither should take a great deal of rework to your current
    interface.

  • Document containing the SAP Files and Directories

    hi,
    Pls let me know the link where i can get the file and directories of location of all sap files such as disptacher logs, profiles etc

    Dear Balaji,
    Run transaction Al11.
    There you can see the directory structure of SAP files.
    Regards,
    Arun
    PS: Reward points are welcome

  • [Solved] File browser that supports mixed files and directories

    Are there any file browsers that show files and directories together, in the way that macs do? Most of the time I like the seperated structure, but for some things I'd like to be able to sort by, say, date modified, and have all the newest files and directories together. I'm hoping I'm just overlooking an option somewhere (I'm using nemo now), but this is kind of a tricky thing to google.
    EDIT
    Just looked again and noticed the option, right there in front of me. Oops. Still, andyone happen to know how to make this a property of a single directory, and not global?
    Last edited by ce1984 (2014-04-25 02:05:16)

    ls - just don't use
    --group-directories-first

Maybe you are looking for

  • Counting Names in a sheet

    Is there a way I can count the number of times a specific name appears in a 14x56 chart. (I'm making a work schedule and need to make sure people have the same number of shifts)

  • HR Report in ALV format

    Hi All, I'm using a LDB 'PNP' and I'd like to select all the active employee in an internal table and display some info related to employee ( name , basic salary ...) in ALV. Can anybody help me coding it please.  Thanks

  • "Gear" Icon with message "Stop email image" what is this?

    I have am running a mac 10.6.3 - 2.4ghz. Recently in the top menu bar an icon which looks like a spinning gear has popped up. When I click on it the message says "stop 'email image'". I have clicked on the icon and selected stop, but nothing happens.

  • Roll back to previous version of Premiere CC

    This might help someone. I was having allot of issues after I updated to 7.2 with audio dissolves and playback so I reverted back to 7.1. This is how to do it: Follow links on this thread on how to download version 7.0.1: http://forums.adobe.com/mess

  • 3D Option Greyed out after windows upgrade?

    Pretty much as the title says. I had windows 7 and photoshop was just fine i could 3d from extrusion layer no problems, but then i upgraded my operating system but nothing else in my cpu so everything is the same. But now i cant click choose any 3d o