01-09-2023, 01:07 PM
(01-09-2023, 01:24 AM)SMcNeill Wrote: How do you open a file for OUTPUT and get it fragmented? All it does is append the data one line after the other automatically.
Can you share an example of this astonishing process? The very idea boggles my brain competely.
Code: (Select All)
_Title "Hack it off"
'
' get home path
'
homepath$ = Command$(0): p = InStr(homepath$, "\"): home$ = Left$(homepath$, p): p = InStr(p + 1, homepath$, "\"): homepath$ = Left$(homepath$, p)
'
' fast clean first
'
If _FileExists(home$ + "save.txt") Then Kill home$ + "save.txt"
Open home$ + "save.org" For Binary As #1
Open home$ + "save.txt" For Output As #2
Print "Please be patient this may take some time ......"
Do Until EOF(1)
Line Input #1, f$
p = InStr(17, f$, "\")
If p <> 0 Then Print #2, Right$(f$, Len(f$) - p)
Loop
System
first 17 characters of each line is not important. The first \ found is the end of directory path information. Everything after is wanted.
It's saved to save.txt using print # statement. This runs nightly in task scheduler. Last night had 23 fragments for save.txt file.
Save.org starts at over 3mb of text. Save.txt ends up just under 2mb of text.
Defraggler from Piriform software was used to determine the number of fragments created.