Hi. I have a 64 GB USB thumb drive which recently stopped working. I'm able to "recover" the files, but when I recover the files they aren't sorted out and there are multiple versions of the same file when I open them and I can't tell which of version of each file is the latest. I tried using the python extension, but even after installing python and the Github powershell script it won't work. I get this error message:
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3
I try adding a 3 at the end of python at the start of the command line only to get this message:
python3: can't open file '/home/darkone/recup_dir.1': [Errno 2] No such file or directory
Can't get the files sorted out(python extension won't work)
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
-
- Posts: 5
- Joined: 17 Apr 2023, 04:00
- cgrenier
- Site Admin
- Posts: 5432
- Joined: 18 Feb 2012, 15:08
- Location: Le Perreux Sur Marne, France
- Contact:
Re: Can't get the files sorted out(python extension won't work)
Code: Select all
import os
import os.path
import shutil
destination = '.'
source = '.'
exts = { 'ab', 'aif', 'apple', 'asf', 'avi', 'bmp', 'cr2', 'Desktop', 'doc', 'docx', 'epub', 'gif', 'html', 'icc', 'ico', 'indd', 'jp2', 'jpg', 'lnk', 'mid', 'mkv', 'mov', 'mp3', 'mp4', 'mpg', 'm2ts', 'nef', 'numbers', 'odt', 'orf', 'pdf', 'plist', 'png', 'ppt', 'pptx', 'psd', 'sqlite', 'svg', 'swf', 'tif', 'ttf', 'txt', 'vfb', 'woff', 'xlsx', 'xml', 'xmp', 'wav', 'wma', 'wmv', 'zip', '3gp'}
for ext in exts:
fn_dir = os.path.join(source, ext)
try:
os.mkdir(fn_dir)
except os.error:
pass
for fn_dir in os.listdir(source):
if fn_dir.startswith("recup_dir."):
# print(fn_dir)
for file in os.listdir(os.path.join(source, fn_dir)):
ext = os.path.splitext(file)[1][1:]
src = os.path.join(source, fn_dir, file)
if ext in exts:
dst = os.path.join(source, ext, file)
# print(src, dst)
os.rename(src, dst)
elif file[0] != '.':
dst = os.path.join(source, 'recup_dir.1', file)
# print(src, dst)
os.rename(src, dst)
-
- Posts: 5
- Joined: 17 Apr 2023, 04:00
Re: Can't get the files sorted out(python extension won't work)
Do you mean launching those command lines in the terminal at the recup_dir.1? I'm not used to python so this is a chance for a learning experience for me.
- cgrenier
- Site Admin
- Posts: 5432
- Joined: 18 Feb 2012, 15:08
- Location: Le Perreux Sur Marne, France
- Contact:
Re: Can't get the files sorted out(python extension won't work)
- Copy /paste the lines in a file named sort_by_ext.py
- If the directories where you have recovered your files are /home/darkone/recup_dir.1 recup_dir.2..., save this file in /home/darkone/
- Run python3 sort_by_ext.py
- If the directories where you have recovered your files are /home/darkone/recup_dir.1 recup_dir.2..., save this file in /home/darkone/
- Run python3 sort_by_ext.py
-
- Posts: 5
- Joined: 17 Apr 2023, 04:00
Re: Can't get the files sorted out(python extension won't work)
Sorry for the late reply. I'm not used to running python. How do I make a python file?
Update:I managed to make the file, but it's not letting put the python file in. How do I manage to move files into the recup_dir1 folder?
Update:I managed to make the file, but it's not letting put the python file in. How do I manage to move files into the recup_dir1 folder?
- cgrenier
- Site Admin
- Posts: 5432
- Joined: 18 Feb 2012, 15:08
- Location: Le Perreux Sur Marne, France
- Contact:
Re: Can't get the files sorted out(python extension won't work)
Do not put the script in recup_dir.1 but in its parent directory.
-
- Posts: 5
- Joined: 17 Apr 2023, 04:00
Re: Can't get the files sorted out(python extension won't work)
I think i'm almost there. I managed to open the terminal at downloads(ironically where the recup_dir.1 files are. After doing so, the other recup_dir folders are completely empty, but for what ever reason I don't think they are in order with the newest version of each file to the last. I have the folder set to sort the files from last modified to first in the folder options. They still seem randomly placed.
Sorry if this is dragging out, but I think I am getting somewhere with the other recup folders being emptied into the first one. Sounds like a step in the right direction. Is there something i'm missing?
-
- Posts: 5
- Joined: 17 Apr 2023, 04:00
Re: Can't get the files sorted out(python extension won't work)
Still here? It's been awhile. Can you send me a link with the file? This is dragging on for too long.