Rabih El Haj youssef
asked on
How to find all zero-byte files in a directory including subdirectories from Command Line ?
How to find all zero-byte files in a directory including subdirectories from Command Line
Look like our file server is affected with virus.
We would like to export all the entire 0KB size files from our server that has hundreds if not thousands of sub-directories and contain files with 0 KB.
Is there a way to do this from the command line?
Prefer a script to export all of them to CSV file. Including the name of the file, Location and date if possible.
Could you please tell me what causing these file to get corrupted with 0KB. How can we fix that or find the route of this issue.
Thank you in advance
Look like our file server is affected with virus.
We would like to export all the entire 0KB size files from our server that has hundreds if not thousands of sub-directories and contain files with 0 KB.
Is there a way to do this from the command line?
Prefer a script to export all of them to CSV file. Including the name of the file, Location and date if possible.
Could you please tell me what causing these file to get corrupted with 0KB. How can we fix that or find the route of this issue.
Thank you in advance
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You can echo the date and time along with the path to each of the files by adding @fdate and @ftime variables before or after the @path.
https://ss64.com/nt/forfiles.html
For example, to output as a CSV that could be opened in Excel, you could first add a header in your command:
echo FileName,Date,Time,FilePat h>list.csv
then in your FORFILES command you could separate the output fields with commas like this:
echo @file,@fdate,@ftime,@path> >list.csv
https://ss64.com/nt/forfiles.html
For example, to output as a CSV that could be opened in Excel, you could first add a header in your command:
echo FileName,Date,Time,FilePat
then in your FORFILES command you could separate the output fields with commas like this:
echo @file,@fdate,@ftime,@path>
ASKER
Thank you very much , it works .
do you know what causing these files to get corrupted ?
also if I want to add some attribute like date and ETC and with nice format . is that possible please?