Click here to Skip to main content
15,881,764 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I wrote following command in windows XP's DOS shell and something strange happened:
C++
C:\Foleder1\copy sample.txt :

because of my typing mistake, I wrote ":" instead of "D:", but it copied the sample.txt to somewhere I cant find!

I searched my whole HDD for sample.txt but the only instance of this file is the original one which is in C:\Folder1
Do you know where ":" path actually is in Win-XP DOS shell?

you may tell ":" is current path and the file have overwritten on itself but look at this, if you run that command for the first time, this will be the result:
C++
1 file copied.

next time you run that command it will ask you:
C++
overwrite sample.txt? (yes/no/all)

so if its going to write the file on itself, both result have to be the same but its not.

thanks in advance for your help
Posted
Updated 20-Oct-12 11:09am
v3

1 solution

Yes it's quite clever!

You've hit upon a syntax for creating an NTFS alternate data stream and I think you will have created an alternate stream named :sample.txt which is a complete copy of the original file but hidden from normal view.

A bit of background is available in http://en.wikipedia.org/wiki/Fork_(file_system)[^] especially in the links at the end of the article.

As XP doesn't contain anything for viewing or deleting these I recommend you download a tool such as AlternateStreamView[^] which will let you see what you've done.

Suprisingly Notepad will let you view a text format alternate data stream. Try typing Notepad :Sample.txt in a command window to see what happens.

Alan.
 
Share this answer
 
Comments
Nelek 20-Oct-12 18:44pm    
Nice answer. Never heard about. +5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900