
If you are only interested in files with a specific extension (e.g. This will create a folder called /home/me/recovered_ext $ bash photorec-sort-by-ext /home/me/recovered_files Here is an alternative implementation which "copies" much more quickly (by creating "hard links"):Įcho "Mirror files from recup_dir into recup_dir.by_ext, organized by extension" įind "$recup_dir" -type f | while read k do
Using a shell script for Mac OS X and Linux all photos taken at one weekend or vacation are sorted into one folder. Within a year folders for every event are created, e.g.
For all jpgs: put them into own folders per year when they have been created (EXIF-Data). The file/folder number can be customized. Limit the number of files/folder by creating subfolders if a certain numbers is exceeded. Sort all files by file extensions into own folders. There is a more extended Python program sort-PhotorecRecoveredFiles that does the following things with your recovered data: py2(os.path.join(root,file), destinationPath) Print('WARNING: this file was not copied :' + os.path.join(root,file)) If os.path.exists(os.path.join(destinationPath,file)): Source = raw_input('Enter a valid source directory\n')ĭestination = raw_input('Enter a valid destination directory\n')įor root, dirs, files in os.walk(source, topdown=False):Įxtension = os.path.splitext(file).upper()ĭestinationPath = os.path.join(destination,extension) $ python recovery.py /home/me/recovered_files /home/me/sorted_files Save the following code as a file (recovery.py) and then run it with the parameters of 'source' & 'destination'.
You can use this Python script to sort found files by extension.Sort files by extension Using a powershell script under Windows 1.4 Using a shell script for Mac OS X and Linux.1.1 Using a powershell script under Windows.