file management

Commands: FileMan


The main function of filemanager of EMEGS is to help you in managing large folder structures containing EEG or MEG data files of a number of subjects,. More specifically this involves renaming files, copying files, deleting files, finding files, creating batch files, creating folders, etc.


All of this can also be done using standard operating system tools (e.g. the windows explorer), but often these tools do not offer the possibilty to do this in batch mode, which means to perform a task automatically on many files. Moreover, this allows incopy/move/delete you any number of files in varying folders in one step (this usually takes many more steps using operating system tools, as most often only multiple objects of one folder can be dragged/copied to another location). Coping, moving and deleting files is done using the 'action'-dropdown menu on the very top of the FileMan menubar. For finding files and creating lists of filepaths/batchfiles, there is a separate menu section at the very bottom of FileMan called 'file finder'. There also are separate sections for file renaming ('file renamer'), creating folder structures ('folder wizard') and averaging ('averager') files. Each funtion type except the averaging will be described in the following. The 'averager' is explained in the 'Averaging across subjects' help section.


Copying, moving and deleting files:  From the action-dropdownmenu select 'movefileto' for copying or moving and 'deletefiles' for deleting files. The activate the 'batchmode'-radiobutton if you want to work on multiple files or the 'singlefilemode'-radiobutton if you wish to perform an action on one specific file. For the batchmode, you then have to activate either the 'directory'-radio or the 'batchfile'-radio, to choose between working on alles files in a specific folder or to work on files in a list. After that push 'choose' in the chosen section to select either the directory containing the files to work on (directory mode) or the textfile containing the paths of the files in the list with one filepath per line of the textfile (make sure to delete empty (whitespace) lines at the end!). If you have chosen a textfile containing a list of filepaths, FileMan checks the filepaths for correct spelling and tells you if all files in the list could be found. Then, when ready, push 'start'. Caution: FileMan does not ask you to confirm your choice!!!! If you have chosen 'deletefiles', all files will be deleted and possibly not be recoverable. If you have chose movefileto, you can choose between moving the files or copying them and then must select a target location (a folder) to move/copy the files to. When done, FileMan should give you a 'job done' message.


Finding files / creating batchfiles (file finder): the file finder always needs a parent folder, to start searching in. This folder is specified, using 'batchmode/directory/choose'-option of the topmost section of FileMan. Once you have chosen this folder, it's path is shown in the white space below the 'directory'-radiobutton. If you then push the search-button in the file-finder-section, FileMan will list the paths of all files in this folder in the command window. You could then copy and paste this output into a textfile.
Moreover, the search results is stored in a memory slot corresponding the number selected in the 'result slot'-dropdownmenu. Selecting this number afterwards will cause the slots content to be reprinted in the command window. Thus, if you are performing multiple searches, set the result slot to the next value before each search to keep all search results in separate slots. You can then merge the slot contents using either the 'zipper '-button or the 'concat'-button. The zipper works only for slot contents of equal lengths and will 'zip' the slot contents together, listing the first files of each slot before moving to the second files of each slot. The concatenator will simply list all files of the first slot, then all files of the second slot and so on. Zipping or concatenated filelists are also stored in the current slot, so if you do not wish to erase any part of a zipped or concatenated list, first select a higher result slot number.
If you wish to restrict your search to specific strings or characters in the name of the file, activate the 'use filterstring'-radio and enter your searchstring in the edit-window on the right of the 'use filterstring'-radio. This searchstring supports one ore multiple wildcards ( * ) to designate any number of characters. Thus, if you wanted to search for files containing the string 'experiment1' you would enter the searchstring '*experiment1*'. If you want the search to be case sensitive, activate the 'case sensitive'-radiobutton. Deactivating the 'full paths'-option will cause FileMan to print only the filename of each file without its folderposition. The 'include subfolders'-option decides wether subfolders of the parentfolder are recursively searched or ignored.
Finding files with almost all the mentioned options (except the use of multiple wildcards and the case sensitivity) can also be done using the command line and the dir2batch command.


Renaming files: like with finding files, before starting the renaming you have to choose the mode for the operation: wether you want to work on a single file, a directory or on file of list (batchfile). You do this using the uppermost section of FileMan - the chosen value in the 'action'-dropdown is irrelevant in this case. Then enter strings in the the edit-boxes 'find files by', 'Find-String' and 'Replace with'. The first is similiar to the searchstring you use in the file finder: it must be found in the filename to select the file for renaming, otherwise the file is ignored. The two other strings define which string in the filename will be replaced by which other. The 'copy & replace'-option creates new file copies that are then renamed. If left deactivated, existing files will be truly renamed. The 'include subfolders'-option is only relevant for the directory mode and decides wether FileMan will recursively descend into subdirectories. After the renaming procedure, FileMan will open two windows containing the original and the modified file names.

Creating folder structures: The folder wizard lets you create a number of folders (NFolders) whith another number of subfolders (NSub) in each. Select a parent folder (using the directory mode) in FileMan topmost section, in which foldercreation will begin. Folders will be named using 2-digit-numbers, preceded by the 'Prefix'. Push 'create' to start folder creation.