The program automatically sorts files by type. How to organize files and folders on your computer


level 80 developer January 31, 2014 at 07:10 pm

Automatic file sorting

I think that most users have encountered the problem of a full “Downloads” folder. I must admit, there are so many files accumulating in this folder that manually deleting them is not an option. In this regard, I want to tell you how to write a program that allows you to automatically sort these files into folders. I've already seen it many times various scripts, which do the same thing, but the difference between the program that we will now write and these scripts is that the files are sorted only when the script is launched, and with the help of our program they will be sorted as they appear.

To implement this task, I chose the C# language. This is due to the cross-platform nature of the language, ease of use and huge amount ready-made classes.
Let's begin.

First, let's connect the necessary libraries

Using System.Windows.Forms; using System.IO;

Let's declare the variables we need

Public static string folders = ( "Images", "Music", "Video", "Documents", "Archives", "Executable" );//Names of folders into which we will place files //Types of files we will move V specific folders public static string ImageTypes = ( ".png", ".jpeg", ".bmp", ".gif" ); public static string MusicTypes = ( ".mp3", ".wav", ".m4a", ".flac" ); public static string VideoTypes = ( ".mp4", ".avi", ".flv", ".wmv" ); public static string DocumentTypes = ( ".doc", ".ppt", ".xls", ".txt", ".pdf" ); public static string ArchiveTypes = ( ".zip", ".rar" ); public static string ExecutableTypes = ( ".exe", ".bat", ".com" ); public static string Trash = (".torrent" ); public static FileInfo info; //File information

Now let's create folders

Foreach(var f in folders) ( if(!Directory.Exists(f)) ( Directory.CreateDirectory(f); ) )

To constantly monitor the appearance of files, we need the FileSystemWatcher class.

FileSystemWatcher watcher = new FileSystemWatcher(Directory.GetCurrentDirectory(), "*.*"); watcher.IncludeSubdirectories = false; watcher.NotifyFilter = NotifyFilters.FileName|NotifyFilters.Attributes|NotifyFilters.CreationTime; watcher.Created += new FileSystemEventHandler(OnCreated); watcher.EnableRaisingEvents = true;

Well, now the most important thing is the file creation event handler.

Public static void OnCreated(object source, FileSystemEventArgs e) ( info = new FileInfo(e.FullPath); if(e.FullPath==Application.ExecutablePath)/*Checks whether this file those who are in this moment executed so as not to throw an exception*/ ( return; ) foreach (var type in ImageTypes) ( if (info.Extension == type) ( info.MoveTo("Images\\" + info.Name); ) ) foreach (var type in MusicTypes) ( if (info.Extension == type) ( info.MoveTo("Music\\" + info.Name); ) ) foreach (var type in VideoTypes) ( if (info.Extension == type) ( info.MoveTo("Video\\" + info.Name); ) ) foreach (var type in DocumentTypes) ( if (info.Extension == type) ( info.MoveTo("Documents\\" + info.Name); ) ) foreach (var type in ArchiveTypes) ( if (info.Extension == type) ( info.MoveTo("Archives\\" + info.Name); ) ) foreach (var type in ExecutableTypes) ( if (info.Extension == type) ( info.MoveTo("Executable\\" + info.Name); ) ) foreach (var type in Trash) ( if (info.Extension == type) ( System.Threading.Thread.Sleep(100) ; info.Delete(); ) ) )

And also, you need to add an infinite loop to Main() so that the program does not close
while(true) ( ​​)

Now this code needs to be compiled and transferred executable file to the "Downloads" folder. The advantage is that this code can be compiled under Windows, Linux and Mac (using Mono).

I hope I made your life easier.

Tags: c#,.NET,Administration

, get tags from file names, etc. On the other hand, you can use the information from the tags to rename audio files, so that instead of names like track01, the program will write meaningful file names according to the pattern you specify.

Sorting music files is directly related to renaming. In the related article, we discussed how to change file names using information from tags. But all of this can also be extended to sorting songs if we use a format that creates folders.

We'll take a group of MP3 files stored in one folder and use mp3Tag Pro to create a clear folder structure. All songs will be sorted into appropriate folders (by music albums). Other supported formats can be sorted in a similar way.

Song selection

As usual, we start by selecting audio files. In the Directories area (1), select the folder containing the audio files you want to sort.

Files from the selected folder will appear in the main area on the right. If there are subfolders and you want to process audio files from these folders as well, click the "Scan subfolders" button.

To select all displayed files, press the green bird button (2) or Ctrl + A on your keyboard.

After this, click “Rename” under the list of files (3).

Renaming and sorting MP3s

mp3Tag Pro will open a new window. All the files we selected in the previous step are shown along with their tags in the main area of ​​the window:

Now you need to select or enter a template in the "Format" field (1). We discussed this in more detail in the renaming article, but now we'll additionally create folders. As usual, all variables can be viewed in the list next to the "Format" field.

To create a folder, use the backslash character in the Format field:

\

For example, we can sort all songs by album without changing the file names:

This format instructs the program to use album names (%L) to create folders. The files in each album will be sorted into their respective folders without being renamed (%O means "Old filename", not to be confused with %0 (zero), which means the track number).

If we sort our music files this way and then open the folder in Windows Explorer, we will see the album folders sorted alphabetically. In most cases, however, it is more natural to sort all of an artist's albums chronologically, by year of release.

We can change the format above to add issue years:

%Y - %L\%O

This will create folders like "1988 - Greatest Hits" and sort the songs into the appropriate folders without renaming them.

But our filenames don't follow any particular pattern, so renaming them might not hurt. Let's change the format again:

%Y - %L\%# - %T

This will rename our files using the pattern<Номер трека> - <Название>, So real names files will look like "01 - Higher Place.mp3".

Now all our songs are sorted by album. This is already better than the unsorted pile of files we had before. But albums are usually released by artists, so we can improve our format by further sorting albums by artist:

%A\%Y - %L\%# - %T

This will create a folder for each artist (%A) in which the program will save all albums of that artist, sorted in chronological order.

Click Rename (2) to sort your music files.

The rename window will close and our MP3s are now sorted.

Further formats

You can easily create custom templates for folders, the same way you create them for file names. In our example, we saw how to create a two-level folder structure (Artists/Albums/Songs), but you can also create 3 or more levels. For example, we can further sort everything by genre:

%G\%A\%Y - %L\%# - %T

You can always see future file/folder names in the preview area of ​​the rename window.

As with file names, you can use any variable from the list next to the Format field for folder names. Additionally, there is a special element for folders: ".." (two dots). It is used to move up one level in the current folder structure. For example, we have the folder structure created in the previous step: Artists / Albums / Songs. Now, if we want to move all the songs from individual album folders to the parent folder of Artists, we can use this format:

Please note that the "one level up" rule applies to the folder selected in the "Directories" area of ​​mp3Tag Pro. If you clicked the "Scan subdirectories" button, you can work with all files from all subfolders. No matter how deep the files are in the selected folder's subdirectory structure, they will all be moved to the parent folder.

Another special element for folders allows you to move files from subfolders to the current one: "." (one point).

If we apply this format instead of the previous one, all songs from individual album folders will be moved to the artist folder (and not to its parent folder, which in our example is "Unsorted").

Using the methods described above, you can easily sort and reorganize songs and other audio files on your drives.

Many people don’t like the random arrangement of elements. So let's look at this moment: how to organize files in a folder in Windows 7, namely sorting and grouping.

If there are not many elements, you can still figure it out, but it happens that files with different extensions or folders are very a large number of. Such an extensive list will be difficult to comprehend. Of course, when everything is laid out on the shelves, it is much more convenient. This is why OS developers came up with special settings ordering filters.

Basic filtering of files and folders: sorting and grouping

You can organize your lists using options:

-sorting – With this setting, you can quickly organize files by size, type (documents, program shortcuts, images, etc.) and much more. To use this option, click on any empty space conductor right click mice. IN context menu Point to the “sorting” item and select the option you want.

You can also use other sorting filters. To do this, select “more details” in the context menu. The “select columns in the table” window will open in front of you. Use the checkboxes to mark which options you want to add. Press the “up” and “down” buttons to determine their location in the context menu.

Don’t forget about the “Ascending” and “Descending” items. If we select the first option, then the sorting will be from 0-9, from A-Z, if the second option, then from Z-A, from 9-0.

By combining sorting types you can get excellent organizing files in a folder in Windows 7. For example, the filter will arrange groups of files by type, and at the same time in ascending order.

- Grouping– with this setting, you can create groups of files and folders by size, name, type. This means you can separate the elements you need from the others.

To use this feature, click on an empty space in Windows Explorer 7 right click. From the menu that appears, select “Grouping” and set any grouping item.

Note: The above methods only apply to the current folder. All new added Extra options The ordering will be displayed in both the “Sorting” and “Grouping” items.

To get rid of grouping elements, click on “(No)”, then all changes will disappear.

The sorting and grouping options can be used simultaneously. For example, you can group by size or type and sort that group by date, name, or other properties.

If you left-click on the group name, then the elements.

Advanced filtering for organizing files and folders in Windows 7: sorting and grouping

For following parameters When filtering, it is mandatory to use the “tile” view. Advanced options can be considered an extension of grouping by filtering. You can even use this to filter based on very specific criteria.

In Tile view, you have multiple columns such as name, data, size, etc. If you hover over the column, you will notice a small arrow on the right side. Click on it and you will see several options that allow you to organize into specific groups (for example, files named A to K).

Select an option and you will see how only files and folders according to the specified criteria will remain. Additionally, you will see a small check mark on the right side of the column, indicating that the filter is active.

You can select from multiple columns based on different criteria. Additionally, it is possible to use the search box to filter even more specific results. To disable advanced grouping, simply uncheck the option.

As you can see, the Explorer window can be quite powerful organize files in a folder in Windows 7. After a little experimentation, you will get used to everything available options and quickly find the elements you are looking for.

If you periodically look through all the folders on your computer to find a specific file, then it’s worth thinking about how to create your own file storage system and organize your workspace once and for all.

To organize files and folders manually, you will have to spend more than one hour, but in the future this time will pay off, since you will know exactly where this or that document is located, and this will inevitably affect the efficiency of your work.

Before you start, you should take a piece of paper and draw future system organizing folders and files on it.

Decide on which drive you will store the information, whether you will duplicate it, and where and how to archive it. It all depends on how much you have logical drives and what cloud storage you use.

Create a hierarchical structure. Think about the names of your main folders: home, work, personal, music, video, pictures, photos, games (there should be minimal amount). Next you need to decide on the names subfolders. There shouldn’t be many of them either – no more than twenty.

For example, the main folder “Home” may include: finances, education, travel, health. Music, videos and books are organized by genre, pictures - by topic: nature, animals. It is better to store photographs separately from pictures.

Cleaning your computer from unnecessary files

Go through your files and delete those you haven't looked at in over a year. If you don't want to delete it, archive it. Rename important documents, group or vice versa, split files by content.

Transfer all documents and folders created on the desktop (if any) to HDD. It is recommended to create only shortcuts to documents and programs on the desktop.

You can also use it to clean your computer. popular program CCleaner.

Organize convenient access to all your folders

Using the Explorer tree, simply drag and drop folders that you use frequently into Favorites. For quick access This folder can be pinned to the taskbar: right-click on it ⇨ Panels ⇨ Create toolbar.

If convenient, use file managers.

Create shortcuts on your desktop.

How to make a shortcut: Right-click on the desktop ⇨ “create shortcut” and copy the path to your folder, file, URL into the window.

Shortcuts can also be created in folders - for example, a link to another, related folder for fast travel between them. For example, in my “Music” folder, which is located on the C: drive, there is a shortcut to the music that I store on the Yandex disk.

A program for recognizing and sorting musical compositions - at picard.musicbrainz.org.
Remove duplicate files, these will help free programs like DupKiller and Auslogics Duplicate File Finder.

In Windows 8 and 8.1, it is possible to place a shortcut to any folder in the tiled Start menu: right-click on the file or folder icon and select “Pin to Start Screen”.

When you have created your system and organized your files and folders, cleared out the garbage, follow simple rules that will help maintain the new order.

How to organize files and folders on your computer, infographic

Rules for storing files and folders

The main rule is that the name of each folder and file should correspond to the content as closely as possible.
Work with files and folders “as input”: it is better to spend time and immediately come up with an adequate name than to review a lot of documents, trying to understand what and where.

For notes and notes, use text files. Create text documents (.txt) in each folder with the name “Read”, where you briefly describe the structure of the folder, everything you consider necessary: ​​which files are duplicated, which version of the document is newer, or how one document differs from another.

Create an “Archive” folder and dump files that are no longer relevant there. Don’t forget about the structure of the archive: so as not to clutter this folder and quickly find required document, create folders in it with names that duplicate your main ones: home, work, photos, etc.

Either rename downloaded files, such as programs, or again create a “Read” file in the folder and briefly describe what the program is. I'm sure this is a problem for many - I downloaded the program and forgot what it was and why it was there at all.

Do not store a hodgepodge of things in one file different topics, better break them down text documents with appropriate names, if you have no time to deal with them.

Organize the contents of large text files you can by creating tables of contents in them. Thus, to find out the contents of a file, you only need to move the cursor to the file shortcut and the first page with the table of contents will appear in the preview.

If the file contains an article or an excerpt from an article from the Internet, a link must be provided to it so that you can return to the original if necessary.

In each folder, you can create a special document where links from the Internet on the topic will be placed, so as not to search in your browser bookmarks.

For working files that are subject to frequent editing and have more than one version, it is worth creating separate folders with txt file, where their history will be briefly described. Instead of names, put the project number and the date the order was received.

For example, PR8_10-03-14 may mean “project number eight from the tenth of March.”

Review all files once a month and get rid of unnecessary ones: delete them or send them to the archive. Old unused files distract attention and interfere with effective work.

And don't forget to duplicate the files that are most important to you.

I hope these tips will help you organize your files and folders, which in turn will increase your productivity.

Although eLiteSort program paid, it can also be used in free mode on permanent basis. Namely, 2000 files for sorting at once and 50 files for sorting every day. Such restrictions will not limit most users. Use it with pleasure.

I’ll tell you my story, I had several cameras, even more memory cards for these cameras, several people who took pictures with these cameras, several computers onto which pictures from these cameras were transferred. As a result, a situation arose where each computer had its own collections of photographs, i.e. some were common with other computers, some were unique, and scattered in folders with incomprehensible names like "101MSCD", DCIM, etc. " new folder"that is, when there are a lot of them, a natural desire arises to “tidy up.” You can also add cases when photos are thrown off the camera’s memory card, but the card is not cleaned, or only part of the photo is thrown off. All this leads to the fact that as a result you you see duplicate photos, but don’t remember where the originals are, etc., etc. It becomes difficult to navigate the collection, let alone make a coherent whole, taking into account the contents of folders on different computers.

My eLiteSort program will help solve this labor-intensive task for a person (when the number of photographs is more than one thousand), a small digression - the lite prefix only speaks of the ease of use of the program and its logic, Deluxe version, etc. no, maybe someday this will happen, but for now, eLiteSort’s capabilities are enough for me. I must say that I tried to make the program interface in such a way that these instructions I didn't have to read it.



Program features

This is actually the sorting of photographs and video files captured on a camera. Video files shot on a camera usually contain information about the image in the form of a (.THM) file, this file makes it possible to correctly judge the date of the video, but usually video files (not from a camera) do not contain information about the shooting date, so it is impossible to reliably sort such files .

To properly sort photos and videos, it is required that the time and date on the camera be set correctly, I think there is no need to explain why.

For ideological reasons, the program does not contain the ability to configure a new file name (photo or video), because This change makes it more difficult to find duplicates, and to find a file in general. Therefore, all files retain the original name, it changes only if the user wants to save two in one folder different files with the same name.

In the program, you can add events, both periodic and for a specific date; in this case, a photo or video file taken on the date of the event will go into a subfolder with the name of the event.

It should also be said that the program has the ability to independently set folder names and the depth of the path where the video or photo will be located.

Sorting photos

Sorting photos is the main purpose of the program and is done very simply and transparently for the user. When you first start the program, specify the folder ( top line program), where we will add the sorting result. Next, drag the folder in which we want to sort the photos into the main field of the program. The program will automatically select the file types suitable for sorting. All that remains is to click the process button and wait for the result of the work to complete. All! - photos are sorted.

Video sorting

The video sorting process is identical to the photo sorting process, the only difference that is not noticeable to the user is that files with the .thm extension (contain information about the video) are not visible to the user.

Video instructions for sorting video and photo files

This process is completely identical for both video and photos. Therefore, the second video is more of a demonstration character.

Sorting photos

Program settings

Adding an event


The need to add an event may arise if you want to create a separate folder for some photos, for example, such holidays as a birthday, wedding, February 23, New Year and other dates. The very addition of the event is very simple procedure- to do this, click the “add event” button, select a date, decide to check the “frequency” box or not, in the case of a birthday you can check the box, but on a wedding day you don’t need to check the box, although it depends on everyone. Editing an event - double click on the event, save the adjustment. Deleting an event - select the desired event and press the delete key.

Setting up your photo folder structure

The structure is configured in the photo hierarchy block of the program settings. The number of lines in the main field is equal to the number of resulting folders, counting from the top. By default, the program has two lines in this field:

  • $YYYY year
  • $MM_$month
Those. As a result, we will get a structure of two folders, the first of which will be called, for example: 2010, and the second 03_March, and the result will be something like this: C:\My photos\2010\03_March\DSC1001.JPG. If we want to add another level - for example day, we simply add another $DD line to the existing lines. If we want the English name of the month, select desired language from the "Month name language" field.

List of placeholders:

  • $YYYY - Four-digit year, for example 2011
  • $YY - Two-digit year, for example 11
  • $MM - Two-digit date month, for example 09
  • $M - Month, without zero padding, for example 9
  • $Month - Name of the month from capital letters, for example October
  • $MONTH - Month name, all capital letters, for example NOVEMBER
  • $month - Name of the month, all letters are small, for example July
  • $DD - Two-digit day of the date, for example 09
  • $D - Day of the date, without padding with zero, for example 9

Other program settings

The program interface language can also be changed in the settings; for the changes to take effect, you need to close the program and start it again.

Video files in separate folder- when this checkbox is selected, all video files transferred to the program for sorting will be placed in the specified subfolder, inside the main path. Those. the entire hierarchy will be created in the specified directory. By default, the video directory is selected, and this solution, in our opinion, is preferable. Although there are users who put video files captured on a camera in the same place where they put photographs. This option also has the right to life, and is not something bad.

Smart sorting in the absence of EXIF ​​information - when this checkbox is selected, if there is no information about the date of creation of the photo or video, the date will be taken from the file attributes, and the smallest date will be taken, usually it is also the date of creation of the photo or video. If this checkbox is not checked, photos and videos that do not contain EXIF ​​will be stored in the folder specified below.

Registration and payment for the program

Purchasing a program through the website website

Purchasing the program through the website is quite transparent. The buyer goes to the program purchase page, enters his name and email, after which he is redirected to the payment acceptance service. Which in turn offers a payment option. After the program is paid for, payment system informs the server about the success of the payment and transmits information about the paid invoice. And on the website, the buyer is given activation details, which he must enter in the program in the activation section.

Purchasing through the program interface

Purchasing a program through the interface differs from purchasing through the website only in that as a result you receive an activation key that is only suitable for the computer from which the payment was initiated, and in the paragraph above you receive an invoice + email, which is suitable for activation later on any computer on which activation will occur. This does not matter for registration, and two methods are used to provide payment alternatives. Those. You can choose any of the options.

Manual payment

Payment in manual mode comes down to the fact that the buyer transfers the required amount to one of the wallets indicated on the website, and notifies the author of the program with any of available ways. Manual mode payment is not automatic. When necessary funds transferred to the specified wallet, I receive a notification about the transferred funds, after which I send the registration data to the buyer that he provided in the notification.

Activation of the program


The user's activation data can be of two types. The first type is the key, the second type is the account number and email of the buyer. The key is provided for a specific computer, account + email for activation on any computer, but after activation this number accounts and email are associated with the computer on which the program was activated. Thus, any of these two types of registration data provide the ability to activate only on one computer. After reinstalling the system, activation keys usually continue to work. The key may stop working after a change on the computer hard drive, network card or motherboard. When changing the unique id of the computer, you can contact the author of the program for help in new activation programs. But since some unscrupulous users try to activate several computers in this way, the author of the program reserves the right to refuse activation if the new id received, in our opinion, is not a derivative of the old one. Activation of the program itself is quite simple - you need to go to the appropriate section in the program and enter the received registration data.

Trial mode restrictions

By default, the program is installed in trial mode, which allows you to understand the capabilities of the program, as well as use it in limited mode. During the first installation of the program, the program provides the ability to sort 2000 files without any restrictions. After completing the main free quantity, it remains possible to sort no more than 50 files every day. Those. in fact, the program continues to work, but in a limited mode. To operate the program in trial mode, an Internet connection is required. After purchase, there is no need to connect to the Internet.







2024 gtavrl.ru.