Reputation: 33
I need a bat file that will list the entire contents of a folder Including its subfolders in a text file.
one of our programs seams to constantly be missing or adding files. a list would help me trackdown the issue(s).
Upvotes: 3
Views: 1627
Reputation: 29369
If your problem is just tracking down what is the program that is creating and removing files, you may monitor all the file accesses in the system with Sysinternals Process Monitor http://technet.microsoft.com/en-us/sysinternals/bb896645 . An easy way to watch all the file accesses being done by any process.
Upvotes: 0
Reputation: 11162
If you have PowerShell, you can use this instead:
cd *<targetdirectory>*
ls -r |% { $_.FullName } | Set-Content foldercontents.txt
I only bring it up, because you can then compare the next time you check to see differences:
$original = Get-Content foldercontents.txt;
$now = ls -r |% { $_.FullName }
Write-Host "Missing Files:";
$original |? { -not $($now -contains $_) };
Write-Host "Added Files:";
$now |? { -not $($original -contains $_) };
Upvotes: 1