From 5d8b7f306fef83ba85f887f0078d1a95637ff36c Mon Sep 17 00:00:00 2001 From: Kaos-Industries Date: Mon, 18 Sep 2017 16:49:45 +0100 Subject: [PATCH 1/8] Update readme.md --- readme.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index cabe074..47f0cc4 100644 --- a/readme.md +++ b/readme.md @@ -1,23 +1,25 @@ -# Sort files recoverd by Photorec +# Origin and Credits -Photorec does a great job when recovering deleted files. But the result is a huge, unsorted, unnamed amount of files. Especially for external hard drives serving as backup of all the personal data, sortig them is an endless job. +This is a fork of tfrdidi's [much-improved fork](https://github.com/tfrdidi/sort-PhotorecRecoveredFiles) of Chris Masterson's [sort-PhotorecRecoveredFiles](https://github.com/ChrisMagnuson/sort-PhotorecRecoveredFiles). The code of this version is unchanged from tifrdidi's version, and was created purely for the purpose of enabling issue tracking and logging the issues I've come across during usage in the hope that others more adept than me at Python can either add to them or fix them. The English of this readme has also been improved for the purpose of making it a little clearer. -This program helps you sorting your files. First of all, the **files are copied to own folders for each file type**. Second, **jpgs are distinguished by the year** when they have been taken **and by the event**. We thereby define an event as a time span during them photos are taken. It has a delta of 4 days without a photo to another event. If no date from the past can be detected, these jpgs are put into one folder to be sorted manually. +# Sort files recovered by Photorec +Photorec does a great job when recovering deleted files, but the result is a huge, unsorted, unnamed amount of files. Particularly for external hard drives that serve as a backup of all your personal data, sorting them is a tedious job. + +This program helps you sort the files that Photorec recovers. First, the **files are sorted into folders by their file extensions**. Second, **JPGs** are then further sorted **by the year they were taken* and **by the event as part of which they were taken**. An event is defined as a 4-day time span in which photos have been taken, though this can be changed - see *"Adjust event distance"*. If no date from the past can be detected, these JPGs are put into one folder to be sorted manually. ## Usage ```python recovery.py ``` -This copies the recovered file to their file type folder in the destination directory. The recovered files are not modified. If a file already exists in the destination directory, it is skipped. Hence you can interrupt the process with Ctrl+C and continue afterwards. +This copies the recovered files to their file type folder in the destination directory. The recovered files are not modified. If a file already exists in the destination directory, it is skipped. This means that the program can be interrupted with Ctrl+C and then continued at a later point by running it again. -The first output of the programm is the number of files to copy. To count them might take some minutes depending on the amount of recovered files. Afterwareds you get some feedback every ~2000 processed files. +The first output of the programm is the number of files to copy. Counting them may take anything from a few minutes to a few hours depending on the amount of recovered files. After that, the program will output feedback every ~2000 processed files. -All directories contain maximum 500 files. If one contains more, numbered subdirectories are created. If you want another file-limit, e.g. 1000, just put that number as third parameter to the execution of the programm: +All directories contain a maximum of 500 files by default. If there are more for a file type, numbered subdirectories are created. If you want another file-limit, e.g. 1000, pass that number as the third parameter when running the program: ```python recovery.py 1000``` - ## Adjust event distance -For the case you want to reduce or increase the timespan between events, simply adjust the variable ```minEventDelta``` in ```jpgHelper.py```. This variable contains the delta between events in seconds. +By default, an event is defined as a 4-day time span in which photos have been taken. If you want to reduce or increase this, simply adjust the variable ```minEventDelta``` in ```jpgHelper.py```. This variable contains the delta between events in seconds. From 4cbc8dcb339502cc2e0a7cb56fd5d72b9aff13f9 Mon Sep 17 00:00:00 2001 From: Kaos-Industries Date: Mon, 18 Sep 2017 16:52:03 +0100 Subject: [PATCH 2/8] Update readme.md --- readme.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 47f0cc4..d020756 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,13 @@ -# Origin and Credits - -This is a fork of tfrdidi's [much-improved fork](https://github.com/tfrdidi/sort-PhotorecRecoveredFiles) of Chris Masterson's [sort-PhotorecRecoveredFiles](https://github.com/ChrisMagnuson/sort-PhotorecRecoveredFiles). The code of this version is unchanged from tifrdidi's version, and was created purely for the purpose of enabling issue tracking and logging the issues I've come across during usage in the hope that others more adept than me at Python can either add to them or fix them. The English of this readme has also been improved for the purpose of making it a little clearer. - # Sort files recovered by Photorec Photorec does a great job when recovering deleted files, but the result is a huge, unsorted, unnamed amount of files. Particularly for external hard drives that serve as a backup of all your personal data, sorting them is a tedious job. This program helps you sort the files that Photorec recovers. First, the **files are sorted into folders by their file extensions**. Second, **JPGs** are then further sorted **by the year they were taken* and **by the event as part of which they were taken**. An event is defined as a 4-day time span in which photos have been taken, though this can be changed - see *"Adjust event distance"*. If no date from the past can be detected, these JPGs are put into one folder to be sorted manually. +## Origin and Credits + +This is a fork of tfrdidi's [much-improved fork](https://github.com/tfrdidi/sort-PhotorecRecoveredFiles) of Chris Masterson's [sort-PhotorecRecoveredFiles](https://github.com/ChrisMagnuson/sort-PhotorecRecoveredFiles). The code of this version is unchanged from tifrdidi's version, and was created purely for the purpose of enabling issue tracking and logging the issues I've come across during usage in the hope that others more adept than me at Python can either add to them or fix them. The bulk of this readme was also written by tfrdidi, and I slightly improved the English for the purpose of making it a little clearer. + ## Usage ```python recovery.py ``` From 3b5439302d7f19ec899931bfbe6a2667d53b2be9 Mon Sep 17 00:00:00 2001 From: Kaos-Industries Date: Mon, 18 Sep 2017 16:52:46 +0100 Subject: [PATCH 3/8] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index d020756..2cc0115 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Photorec does a great job when recovering deleted files, but the result is a huge, unsorted, unnamed amount of files. Particularly for external hard drives that serve as a backup of all your personal data, sorting them is a tedious job. -This program helps you sort the files that Photorec recovers. First, the **files are sorted into folders by their file extensions**. Second, **JPGs** are then further sorted **by the year they were taken* and **by the event as part of which they were taken**. An event is defined as a 4-day time span in which photos have been taken, though this can be changed - see *"Adjust event distance"*. If no date from the past can be detected, these JPGs are put into one folder to be sorted manually. +This program helps you sort the files that Photorec recovers. First, the **files are sorted into folders by their file extensions**. Second, **JPGs** are then **further sorted by the year they were taken** and **by the event as part of which they were taken**. An event is defined as a 4-day time span in which photos have been taken, though this can be changed - see *"Adjust event distance"*. If no date from the past can be detected, these JPGs are put into one folder to be sorted manually. ## Origin and Credits From bf9aa63c348cb63f204830b21f66f16d74f38717 Mon Sep 17 00:00:00 2001 From: Kaos-Industries Date: Mon, 18 Sep 2017 16:53:34 +0100 Subject: [PATCH 4/8] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 2cc0115..0548523 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Photorec does a great job when recovering deleted files, but the result is a huge, unsorted, unnamed amount of files. Particularly for external hard drives that serve as a backup of all your personal data, sorting them is a tedious job. -This program helps you sort the files that Photorec recovers. First, the **files are sorted into folders by their file extensions**. Second, **JPGs** are then **further sorted by the year they were taken** and **by the event as part of which they were taken**. An event is defined as a 4-day time span in which photos have been taken, though this can be changed - see *"Adjust event distance"*. If no date from the past can be detected, these JPGs are put into one folder to be sorted manually. +This program helps you sort the files that Photorec recovers. First, the **files are sorted into folders by their file extensions**. Second, **JPGs** are then further sorted **by the year they were taken** and **by the *event* as part of which they were taken**. An event is defined as a 4-day time span in which photos were taken, though this can be changed - see *"Adjust event distance"*. If no date from the past can be detected, these JPGs are put into one folder to be sorted manually. ## Origin and Credits From 55284d3501236966f49d4f70d11859089be5ad34 Mon Sep 17 00:00:00 2001 From: Kaos-Industries Date: Mon, 18 Sep 2017 16:53:55 +0100 Subject: [PATCH 5/8] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 0548523..85a0c75 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Photorec does a great job when recovering deleted files, but the result is a huge, unsorted, unnamed amount of files. Particularly for external hard drives that serve as a backup of all your personal data, sorting them is a tedious job. -This program helps you sort the files that Photorec recovers. First, the **files are sorted into folders by their file extensions**. Second, **JPGs** are then further sorted **by the year they were taken** and **by the *event* as part of which they were taken**. An event is defined as a 4-day time span in which photos were taken, though this can be changed - see *"Adjust event distance"*. If no date from the past can be detected, these JPGs are put into one folder to be sorted manually. +This program helps you sort the files that Photorec recovers. First, the **files are sorted into folders by their file extensions**. Second, **JPGs** are then further sorted **by the year they were taken** and **by the event as part of which they were taken**. An event is defined as a 4-day time span in which photos were taken, though this can be changed - see *"Adjust event distance"*. If no date from the past can be detected, these JPGs are put into one folder to be sorted manually. ## Origin and Credits From 1a98397fbf7fb5d8972acd59518fb87a68e6ad30 Mon Sep 17 00:00:00 2001 From: Kaos-Industries Date: Sat, 30 Mar 2019 19:24:09 +0000 Subject: [PATCH 6/8] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 85a0c75..17b804b 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ This program helps you sort the files that Photorec recovers. First, the **files ## Origin and Credits -This is a fork of tfrdidi's [much-improved fork](https://github.com/tfrdidi/sort-PhotorecRecoveredFiles) of Chris Masterson's [sort-PhotorecRecoveredFiles](https://github.com/ChrisMagnuson/sort-PhotorecRecoveredFiles). The code of this version is unchanged from tifrdidi's version, and was created purely for the purpose of enabling issue tracking and logging the issues I've come across during usage in the hope that others more adept than me at Python can either add to them or fix them. The bulk of this readme was also written by tfrdidi, and I slightly improved the English for the purpose of making it a little clearer. +This is a fork of tfrdidi's [much-improved fork](https://github.com/tfrdidi/sort-PhotorecRecoveredFiles) of Chris Masterson's [sort-PhotorecRecoveredFiles](https://github.com/ChrisMagnuson/sort-PhotorecRecoveredFiles). The code of this version is unchanged from tifrdidi's version, and was created purely for the purpose of enabling issue tracking and logging the issues I've come across during usage in the hope that someone more adept than me at Python either fix them or contribute to them. The bulk of this readme was also written by tfrdidi, and I improved the English slightly for the purpose of making it clearer. ## Usage From 4020afb1f5a376b6b1e5fa001e28fcb811de6648 Mon Sep 17 00:00:00 2001 From: Hashim Aziz Date: Mon, 4 Apr 2022 21:40:40 +0100 Subject: [PATCH 7/8] Update readme.md --- readme.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/readme.md b/readme.md index 458a633..450ab6a 100644 --- a/readme.md +++ b/readme.md @@ -4,10 +4,6 @@ Photorec does a great job when recovering deleted files. But the result is a hug This program sPRF helps you sorting your files. First of all, the **files are copied to own folders for each file type**. Second, **jpgs are distinguished by the year, and optionally by month as well** when they have been taken **and by the event**. We thereby define an event as a time span during them photos are taken. It has a delta of 4 days without a photo to another event. If no date from the past can be detected, these jpgs are put into one folder to be sorted manually. -## Origin and Credits - -This is a fork of tfrdidi's [much-improved fork](https://github.com/tfrdidi/sort-PhotorecRecoveredFiles) of Chris Masterson's [sort-PhotorecRecoveredFiles](https://github.com/ChrisMagnuson/sort-PhotorecRecoveredFiles). The code of this version is unchanged from tifrdidi's version, and was created purely for the purpose of enabling issue tracking and logging the issues I've come across during usage in the hope that someone more adept than me at Python either fix them or contribute to them. The bulk of this readme was also written by tfrdidi, and I improved the English slightly for the purpose of making it clearer. - ## Installation First install the package [exifread](https://pypi.python.org/pypi/ExifRead): From 4bf4057cff67e0d9306a649ca6996353ba4ccfc7 Mon Sep 17 00:00:00 2001 From: Peter Bozsoky Date: Tue, 12 Apr 2022 16:22:05 +0200 Subject: [PATCH 8/8] file sorting: Accomodate files without a suffix --- recovery.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recovery.py b/recovery.py index 459e663..d83a4d8 100755 --- a/recovery.py +++ b/recovery.py @@ -102,14 +102,20 @@ for root, dirs, files in os.walk(source, topdown=False): extension = os.path.splitext(file)[1][1:].upper() sourcePath = os.path.join(root, file) - destinationDirectory = os.path.join(destination, extension) + if extension: + destinationDirectory = os.path.join(destination, extension) + else: + destinationDirectory = os.path.join(destination, "_NO_EXTENSION") if not os.path.exists(destinationDirectory): os.mkdir(destinationDirectory) if keepFilename: fileName = file else: - fileName = str(fileCounter) + "." + extension.lower() + if extension: + fileName = str(fileCounter) + "." + extension.lower() + else: + fileName = str(fileCounter) destinationFile = os.path.join(destinationDirectory, fileName) if not os.path.exists(destinationFile):