Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there a way to move a file to a specific place on the disk, like the start?

2 views
Skip to first unread message

micky

unread,
Oct 3, 2011, 6:16:14 PM10/3/11
to
(Please remember that this is a hobby for me, and I myself know an
easier likely way to get to the final result here, but it won't
involve a question that has intrigued me for years.)

The question is: Is there a way to move a file to a specific place on
the disk or partition, like the start?

Without writing code in Assember. This question has botthered me for
years. Once in a while there is a practical application.

I tthink if the partition were full to overflowing, and I coudl find
out the name of a file that Old was the first in the partition that
was as big as File F, the file I wanted at the start, I could delete
Old, and copy F to the partition, and it would go in the spot that Old
had used.

But what if the partition has loads of empty space? What do MS-DOS
and PC-DOS and various versions of windows do? Lets assume either an
NTFS or FAT32 partition. Does it make a difference?

Will it move it to
1) the next available space (next after the last file moved),
2) the first available space (which is almost the very start of the
parition.) . There is either enough empty space at the start of the
partition for this file to be stored in one piece, or there is loads
of empty space.
3) Or will it try to move the file to be near other files in the same
sub-sub-directory in which this new file will reside,, or at least the
same sub-directory, or at least the same highest level directory?

Option 3 seems to violate all the rules I've heard of, but I can't
help thinking that's what will happen.

Option 2 is what I want. Is it likely I'll get it?

Arno

unread,
Oct 3, 2011, 7:20:00 PM10/3/11
to
In comp.sys.ibm.pc.hardware.storage micky <NONONO...@bigfoot.com> wrote:
> (Please remember that this is a hobby for me, and I myself know an
> easier likely way to get to the final result here, but it won't
> involve a question that has intrigued me for years.)

> The question is: Is there a way to move a file to a specific place on
> the disk or partition, like the start?

> Without writing code in Assember. This question has botthered me for
> years. Once in a while there is a practical application.

It depends on the filesystem. With classical FAT, create a
new FAT filesystem and put the files on it. It will fill up
from the start. It may also be possible to use some defraggers
to the same effect. Other placement can then be achived by
filling up to the start where the files should go iwth other
data, writing the data and then remove the other files.

Other than that, you will need to programm. For a modern
filesystem like ext2/3 or NTFS, this will be hugely
complicated.

> I tthink if the partition were full to overflowing, and I coudl find
> out the name of a file that Old was the first in the partition that
> was as big as File F, the file I wanted at the start, I could delete
> Old, and copy F to the partition, and it would go in the spot that Old
> had used.

Ah, that is easier: Overwrite the old file with the new one
(not cp, file open and then write the data over it from the
beginning). Still requires coding and will not work everywhere,
but is pretty simple to do.

> But what if the partition has loads of empty space? What do MS-DOS
> and PC-DOS and various versions of windows do? Lets assume either an
> NTFS or FAT32 partition. Does it make a difference?

Very much. For FAT, new writes typically go into the first
empty space on disk. That is also why it fragments so badly.
For NTFS, I would guess that it works kind of like ext2/3
and has several pints on the disk that it groups files
around (very rough approximation).

> Will it move it to
> 1) the next available space (next after the last file moved),
> 2) the first available space (which is almost the very start of the
> parition.) . There is either enough empty space at the start of the
> partition for this file to be stored in one piece, or there is loads
> of empty space.

Here is the kicker: The decision is made _without_ knowing the
file size! The problem is that on file creation you do not
pass a parameter saying "and, hey, this is going to be this large".
You just do file creation and start writing.

> 3) Or will it try to move the file to be near other files in the same
> sub-sub-directory in which this new file will reside,, or at least the
> same sub-directory, or at least the same highest level directory?

I think a bit of that is going on in ext2/3, bit it is not
strictly directory orientated.

> Option 3 seems to violate all the rules I've heard of, but I can't
> help thinking that's what will happen.

> Option 2 is what I want. Is it likely I'll get it?

With FAT, maybe. Otherwise no.
Typically you do not want it today though.

Arno
--
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: ar...@wagner.name
GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans

Rod Speed

unread,
Oct 3, 2011, 9:46:31 PM10/3/11
to
micky wrote

> (Please remember that this is a hobby for me, and I myself
> know an easier likely way to get to the final result here, but
> it won't involve a question that has intrigued me for years.)

Dont forget what curiosity did to the cat.

> The question is: Is there a way to move a file to a
> specific place on the disk or partition, like the start?

Yes.

> Without writing code in Assember.

Yes.

> This question has botthered me for years.
> Once in a while there is a practical application.

I'm not convinced that there is.

> I tthink if the partition were full to overflowing, and I coudl find out
> the name of a file that Old was the first in the partition that was as
> big as File F, the file I wanted at the start, I could delete Old, and
> copy F to the partition, and it would go in the spot that Old had used.

Yes.

> But what if the partition has loads of empty space?

One obvious approach is to fill that space by writing files too it until
it is full, and naming them with an name that allows a wildcard deletion
of all of those files once you have written the file you want to write to
the place you want to write it.

> What do MS-DOS and PC-DOS and various versions of windows do?

That varys quite a bit between versions.

> Lets assume either an NTFS or FAT32 partition. Does it make a difference?

Yes, the later versions of NTFS do a better job of avoiding framentation
and can write the file into the first free space thats big enough for it.

> Will it move it to
> 1) the next available space (next after the last file moved),
> 2) the first available space (which is almost the very start of the parition.) .

That varys with the version, how full the partition is,
how long its been since its been booted etc etc etc.

> There is either enough empty space at the start of the partition for
> this file to be stored in one piece, or there is loads of empty space.

> 3) Or will it try to move the file to be near other files in the
> same sub-sub-directory in which this new file will reside,,

Nope.

> or at least the same sub-directory, or at least the same highest level directory?

Nope.

> Option 3 seems to violate all the rules I've heard of,

And there isnt any point in doing it that way, so isnt done enough to matter.

> but I can't help thinking that's what will happen.

It wont.

> Option 2 is what I want. Is it likely I'll get it?

You can do with some versions, particularly if you reboot before
writing to the drive and just delete the file that occupys that place
just before writing the file you want there to that partition, particularly
with non system partitions. Can get messy with system partitions.

It isnt that hard to write a file where you want it to go thats free without using assembler.

You can even do it with some drive utes like Norton's Disk Editor for example.


shawn

unread,
Oct 4, 2011, 6:19:10 AM10/4/11
to
On Mon, 03 Oct 2011 18:16:14 -0400, micky <NONONO...@bigfoot.com>
wrote:

>(Please remember that this is a hobby for me, and I myself know an
>easier likely way to get to the final result here, but it won't
>involve a question that has intrigued me for years.)
>
>The question is: Is there a way to move a file to a specific place on
>the disk or partition, like the start?

I haven't done it for a particular file but I have used this method to
move particular directories to certain areas of the disk (though it
should work just as well for a file.) Use a tool like MyDefrag and
write a custom script (it's not that hard since there are already
scripts that reference particular files (system files.)

With MyDefrag you can specify certain types of files, directories or
even a particular file to go into specific zones (and you can define
the zones to be whatever you want. http://www.mydefrag.com/
This is a Windows specific program but there may be something similar
in Linux and other operating systems.

micky

unread,
Oct 14, 2011, 12:56:02 PM10/14/11
to
On Tue, 04 Oct 2011 06:19:10 -0400, shawn <nanof...@gNOTmail.com>
wrote:

Thanks. I dl'd this but haven't had a chance to use it. I figured
since it's been 10 days since you post ed, I should thank you now
instead of waiting. It sounds good.

And thank you also, Arno and Rod. I have a better understanding of
how this all works and what to do.


Richard Bonner

unread,
Oct 24, 2011, 11:51:53 AM10/24/11
to
micky (NONONO...@bigfoot.com) wrote:
> Is there a way to move a file to a specific place on
> the disk or partition, like the start?

*** The way I would move a file to the start of a drive with my present
DR-DOS system would be to rename the file with the first character as `!'
(an exclamation). I would then use Norton's "DS.exe" to sort the files on
the drive by name, and with the "Directories First" option turned off.

The above method places a file first on a drive excluding any system
boot files that must occupy that spot, or possibly certain hidden files
used by DOS that might start with `!'.

To put a file in a specific spot other than first, one could use a
Disk Editor, but I am not versed enough in its usage to give specific
instructions.

--
Richard Bonner
http://www.chebucto.ca/~ak621/DOS/

0 new messages