Delete 0 byte files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
pprior
Posts: 2
Joined: 20 Nov 2013 11:56

Delete 0 byte files

#1 Post by pprior » 20 Nov 2013 12:06

Hi all,
I had a hard drive problem and some of my files were damaged.
I have a backup but from the damaged drive I can still get some information.
So i need to build a script to analize my drive and copy all the content to my backup disk.
The problem is using
xcopy source destination /s /d
I get all the files on the orignal hard drive overwriting the backup files, even the damaged ones with 0 byte size...

So I need first to find and delete those 0 byte files and then copy all the others.

Can you help me?


pprior
Posts: 2
Joined: 20 Nov 2013 11:56

Re: Delete 0 byte files

#3 Post by pprior » 20 Nov 2013 12:34

Thanks! I've seen it already but i need it to go throug all the folders and first I wanto to run it in "test mode", like creating a text file with all before deleting them.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Delete 0 byte files

#4 Post by Squashman » 20 Nov 2013 12:36

Have you read the help for the DIR, FOR and FORFILES commands. All of them have options to recurse into subdirectories.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Delete 0 byte files

#5 Post by foxidrive » 20 Nov 2013 21:01

If you are serious about data recovery, and you only have one backup, then you first need to create a second copy of the backup drive - in case the other hard drive fails or becomes corrupted too.

Copying files from a damaged drive onto your only backup is foolish, and from what you've said this is what you plan to do.




I would also make a copy of the damaged drive onto another hard drive too - if it has more up to date files than your backup has.

shayanjameel08
Posts: 10
Joined: 21 Nov 2013 01:07

Re: Delete 0 byte files

#6 Post by shayanjameel08 » 23 Nov 2013 05:39

They are often put in the "temporary internet files" by some program and when trying to delete an old user profile it prevents the deletion.

Post Reply