Discuss Scratch

Aspirus
Scratcher
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
Scratcher
500+ posts

File System in scratch

-Not the answer they wanted-

Last edited by FloralAnimator (Nov. 12, 2020 12:37:15)

Aspirus
Scratcher
14 posts

File System in scratch

FloralAnimator wrote:

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
Scratcher
1000+ posts

File System in scratch

FloralAnimator wrote:

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-
I don't think that's what they want- I think they're trying to make some sort of filing system in scratch
FloralAnimator
Scratcher
500+ posts

File System in scratch

mtech22 wrote:

FloralAnimator wrote:

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-
I don't think that's what they want- I think they're trying to make some sort of filing system in scratch
Oh alright.
-CloudGate-
Scratcher
1000+ posts

File System in scratch

ok then make your own using lists
Aspirus
Scratcher
14 posts

File System in scratch

-CloudGate- wrote:

ok then make your own using lists
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
imfh
Scratcher
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:

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
Scratcher
14 posts

File System in scratch

imfh wrote:

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
Scratcher
1000+ posts

File System in scratch

Aspirus wrote:

-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
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).

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
Scratcher
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
whenIreceivereleasedsayhave fun!showlistlocationshowlistfile managershowlistlocation data

Last edited by scratch_cat787 (Oct. 20, 2021 16:05:30)

scratch_cat787
Scratcher
96 posts

File System in scratch

Aspirus wrote:

imfh wrote:

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
Ummm can you please use blocks in my blocks and run without screen refresh?

Powered by DjangoBB