Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » File System in scratch
- Aspirus
-
14 posts
File System in scratch
So, i was wondering if we could create a file system in scratch to store files and access them in a manner how we do in our computers ( like having directories and files nested), any idea for implementing such thing in scratch? so far i asked griffpatch he told we could have 4 lists for name, parent, child, data to store each object another list to store the dir or file type
- FloralAnimator
-
500+ posts
File System in scratch
-Not the answer they wanted-
Last edited by FloralAnimator (Nov. 12, 2020 12:37:15)
- Aspirus
-
14 posts
File System in scratch
I'm not sure if this is what you are talking about, but its already there. Go to file and press ‘save to your computer’ or ‘load from your computer’:no
Last edited by Aspirus (Nov. 12, 2020 12:35:43)
- mtech22
-
1000+ posts
File System in scratch
I don't think that's what they want- I think they're trying to make some sort of filing system in scratch I'm not sure if this is what you are talking about, but its already there. Go to file and press ‘save to your computer’ or ‘load from your computer’:
-snip-
- FloralAnimator
-
500+ posts
File System in scratch
Oh alright.I don't think that's what they want- I think they're trying to make some sort of filing system in scratch I'm not sure if this is what you are talking about, but its already there. Go to file and press ‘save to your computer’ or ‘load from your computer’:
-snip-
- Aspirus
-
14 posts
File System in scratch
i was asking for ideas to implement it , at this stage i have not found a way to implement this thats why i asked in the forums ok then make your own using lists
- imfh
-
1000+ posts
File System in scratch
I've thought about making one in the past, and it is definitely possible. However, it would be rather difficult. Perhaps a somewhat simplified way to do ut would be with lists.
Each folder and the names of its contents are stored in list Folders. The folders might be stored like this:
To find a item, you would use item # of (full path, eg. C:\User\pi). You could then get the next list item to see how many items are in the folder. For files, you would need two more lists, Filenames and Data. You could then use item # of (full path, eg. C:\my_file.txt) on Filenames to get the position of the file data in the Data list.
Each folder and the names of its contents are stored in list Folders. The folders might be stored like this:
C:
3 (Number of files/folders)
Windows
User
my_file.txt
C:\Windows
1
System32
C:\System32\Windows
1
system.dat
C:\User
1
pi
(You get the idea)
To find a item, you would use item # of (full path, eg. C:\User\pi). You could then get the next list item to see how many items are in the folder. For files, you would need two more lists, Filenames and Data. You could then use item # of (full path, eg. C:\my_file.txt) on Filenames to get the position of the file data in the Data list.
Filenames Data
C:/my_file.txt Hello there!
C:/System32/Windows/system.dat password=1234
- Aspirus
-
14 posts
File System in scratch
I've thought about making one in the past, and it is definitely possible. However, it would be rather difficult. Perhaps a somewhat simplified way to do ut would be with lists.
Each folder and the names of its contents are stored in list Folders. The folders might be stored like this:C:
3 (Number of files/folders)
Windows
User
my_file.txt
C:\Windows
1
System32
C:\System32\Windows
1
system.dat
C:\User
1
pi
(You get the idea)
To find a item, you would use item # of (full path, eg. C:\User\pi). You could then get the next list item to see how many items are in the folder. For files, you would need two more lists, Filenames and Data. You could then use item # of (full path, eg. C:\my_file.txt) on Filenames to get the position of the file data in the Data list.Filenames Data
C:/my_file.txt Hello there!
C:/System32/Windows/system.dat password=1234
The problem with this is that the file system would get pretty slow as files fill up the space and the item # of () block is quite slow on its own
- imfh
-
1000+ posts
File System in scratch
It's not actually that slow. I made a list with 100,000 items (0 to 100,000) and then used item # of to find random items (from 0 to 100,000). It took 0.362 seconds to find a random item 1000 times (2,762 items per second). -snip-
The problem with this is that the file system would get pretty slow as files fill up the space and the item # of () block is quite slow on its own
100,000 items is a lot; you probably won't have that many items. You also probably won't need to find 2,762 items in a single second.
- scratch_cat787
-
96 posts
File System in scratch
It is simple to make it.
Just use lists
List #1 name:location
List #2 name:file manager
List #3 name:location data
And I am working on mobile so it will take a while to develop the project.
Also
Just use lists
List #1 name:location
List #2 name:file manager
List #3 name:location data
And I am working on mobile so it will take a while to develop the project.
Also
Last edited by scratch_cat787 (Oct. 20, 2021 16:05:30)
- scratch_cat787
-
96 posts
File System in scratch
Ummm can you please use blocks in my blocks and run without screen refresh?I've thought about making one in the past, and it is definitely possible. However, it would be rather difficult. Perhaps a somewhat simplified way to do ut would be with lists.
Each folder and the names of its contents are stored in list Folders. The folders might be stored like this:C:
3 (Number of files/folders)
Windows
User
my_file.txt
C:\Windows
1
System32
C:\System32\Windows
1
system.dat
C:\User
1
pi
(You get the idea)
To find a item, you would use item # of (full path, eg. C:\User\pi). You could then get the next list item to see how many items are in the folder. For files, you would need two more lists, Filenames and Data. You could then use item # of (full path, eg. C:\my_file.txt) on Filenames to get the position of the file data in the Data list.Filenames Data
C:/my_file.txt Hello there!
C:/System32/Windows/system.dat password=1234
The problem with this is that the file system would get pretty slow as files fill up the space and the item # of () block is quite slow on its own
- Discussion Forums
- » Questions about Scratch
-
» File System in scratch