I am new to using windows command prompt so apologies if this is a simple question. I am using forfiles to produce a list of all files within a folder and its subdirectories, with this list also including the files last date and time modified. This works correctly but for some files the list will print a ~$ within the files name even though the actual file name does not include this. For example the command returns:
ExampleFolder1\ExampleFolder2\~$Examplefilename.docx 10/10/2010 10:10
when it should return
ExampleFolder1\ExampleFolder2\Examplefilename.docx 10/10/2010 10:10
This only happens for some of the files within the printed list.
Additionally, sometimes the file with the ~$ printed when forfiles is run is the name of a file that does not actually exist in the folder and on some occasions it appears to be a copy of a file that has already been printed when forfiles is ran but the time modified shall differ. For example forfiles may return:
ExampleFolder1\ExampleFolder2\Examplefilename.docx 10/10/2010 10:10
ExampleFolder1\ExampleFolder2\~$Examplefilename.docx 11/11/2010 20:10
I was just wondering if anyone else had come across this issue?
The only theory I had is maybe its returning ~$ file names for files that have been deleted or cut and moved elsewhere, but I have limited knowledge in command prompt so i'm not sure at all.
Here is the code I have been using to print a list all files and subdirectory files for a folder (excluding directories):
FORFILES /s /c "cmd /c if @isdir==FALSE echo @path @fdate @fdate"
Ideally I would just like to know the reason for why such files are being printed. Thanks for any help
~$
at the start of a filename, even using the Find functionality in Notepad++. As the examples you describe both have a.docx
extension, I'd suspect that those are Word backup files and that they actually do exist on your system.~$
, but have different date and time stamps, also typical of a Word backup file.