deleting stubborn folders/files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
mipak
Posts: 2
Joined: 28 Aug 2013 09:55

deleting stubborn folders/files

#1 Post by mipak » 29 Aug 2013 23:38

My currant problem to delete files etc. is now largely academic but I would like to know if there is a simple solution for the next time please.

Objective: to delete files & folders that refuse to 'go away'.

On my second hard drive (D:), there were a number of folders along with their attending sub-folders & files, all without attributes, which I was unable to delete in windows (running XP).
I then used 'del', 'deltree' & 'rd' in safe-mode dos but 'dir /p' brought them all back up again which was confirmed when I went back into windows. I even tried to format the drive using 'format d: /fs:ntfs' but that was a no-no too!

As I was planning to format the drive anyway, I decided to re-boot from my XP installation disk and delete and re-create the partition. That worked just fine and when I re-booted into windows, I just formatted the drive and all was well but that was only possible because as I said, my end target was to have a clean drive.

So what I'd like to find out for the future is how I can get rid of folders etc. that refuse to be deleted without having to resort to partitioning.

I hope all this makes sense and would be grateful for any advice please.

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

Re: deleting stubborn folders/files

#2 Post by foxidrive » 30 Aug 2013 06:18

It matters what kind of files and folders they were.

The permissions of the folders and files probably affected what you were doing.

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: deleting stubborn folders/files

#3 Post by penpen » 30 Aug 2013 12:54

The most files/directories can be deleted using SYSTEM rights.
You have to login with an Administrator account.
Then you execute:

Code: Select all

at.exe 21:00 /INTERACTIVE "cmd.exe"
Where 21:00 should be a time in (near) future.

At the specified time a cmd window opens, within you have SYSTEM rights.
All files /directories, that are not locked/rewritten should be deletable now.

If you want to delete locked files you may use the program "unlocker", or something like that.
If files are getting rewritten, then you should use "process monitor" to find out which apllication rewrites it.
If you shut this application down, or tell the application to use another directory on another partition, then no files should be rewritten.

penpen

mipak
Posts: 2
Joined: 28 Aug 2013 09:55

Re: deleting stubborn folders/files

#4 Post by mipak » 01 Sep 2013 10:33

i'm the sole user so have full admin rights ...
the file names consisted of alpha numeric characters and at the risk of some slight exaggeration, were a million miles long!!!
got access to the next level of sub-folders but it was a no-go beyond that.
think they were to do with microsoft re-installation data but as mentioned originally, it's academic now as i re-partioned (via the first part of my xp cd) and re-formatted the drive in windows.
works perfectly now.
at least i now know how to delete using dos should the occasion arise again in the future.
have also downloaded 'unlocker' for future use though think i'd prefer to use dos.

thanks a stack for your suggestions ... very much appreciated.

TechnoMage
Posts: 4
Joined: 05 Jun 2013 18:22
Location: Central Florida

Re: deleting stubborn folders/files

#5 Post by TechnoMage » 01 Sep 2013 12:06

I'm an old DOS user, going all the way back to DOS 2.0.

Not until Windows came along, did I ever have any problem controlling what was on my hard drive.
Today, scripts like "Disable UAC" can help some, but they are not the ultimate solution to the problem
of user control of his/her own computer. Another help, for Windows Vista or later, is the program called
"Grant Admin Full Control". Similar to "Take Ownership", on steroids.
But even that is not a 100% solution to the problem of user access to files and folders.
Adding or deleting files from C:\ is a good example.

So what to do?

Well, here's what I do.
I have a DOS Utilities disk (CD or Flash drive) that has all my DOS tools on it, including a little program,
called NTFS4DOS. So, I can boot up my PC in DOS, then from my dos menu I run NTFS4DOS and it allows
me to see every file on the NTFS drive, from a DOS command prompt. Then I can do anything I please, with
the files and folders on the HD. Without Windows running, there are no "Permissions".

I run a series of batch files, using the old Deltree command, to delete things like the Pagefile and the System Restore Points,
as well as all the other locations where windows and programs store their junk files.

Doing a cleanup of my HD from my DOS Utilities disk, allows me to delete over 4 gig's of junk; things that windows would never let me delete.
Then I can do a Partition Backup, without having to back up so much junk.

Anyone can build their own DOS Utilities disk or get a copy of mine. Just ask.

Cheers mates!
8)

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

Re: deleting stubborn folders/files

#6 Post by foxidrive » 02 Sep 2013 03:46

mipak wrote:i'm the sole user so have full admin rights ...


That isn't quite the whole story as Windows doesn't give admin full access any more.


TechnoMage wrote:I have a DOS Utilities disk (CD or Flash drive) that has all my DOS tools on it, including a little program,
called NTFS4DOS. So, I can boot up my PC in DOS, then from my dos menu I run NTFS4DOS and it allows
me to see every file on the NTFS drive, from a DOS command prompt.


These days it is better to boot up a cdrom of a Live linux distro and do what you need to, and from a GUI file manager too.
This method also allows you to easily mount a USB hard drive or flash drive to copy and backup things, with ease, as well as delete anything.

I'm also comfortable in Dos but I wouldn't use it to do these things when I can do it simply in a Linux GUI.

TechnoMage
Posts: 4
Joined: 05 Jun 2013 18:22
Location: Central Florida

Re: deleting stubborn folders/files

#7 Post by TechnoMage » 07 Sep 2013 06:30

I originally came here because the name of the forum was/is "dostips.com"
because I've been using DOS since Dos 2.0 in ~1980.

So I look for DOS Tips, and not Linux. Telling an old DOS user to use Linux is like telling us to stand on our head and speak Russian.
It's totally foreign to us and NOT what we (I) came here for.

Windows throws all sorts of roadblocks in the path of the user, who wants to be in-charge of his/her computer.
I get furious over all this "Permissions" BS! I built this dang computer, I installed the OS and I'm the ONLY user, so why should I
ever need "Permission" to do anything I want with it? Because MS says so? That's pure BS!

So I, like many others, fall back on what we know works.....DOS.

I still run XP on a FAT-32 formatted hard drive. It's faster than NTFS and I can access any file on the HD from my DOS boot disk.
Permissions? Forgetaboutit!!!

If you've never tried NTFS4DOS, to access files on an NTFS drive, from DOS, try it.....you'll like it!
You can't really get to DOS from within Windows, so make yourself a DOS boot disk. I did, a long time ago.

Well, that's my little rant for a sunny Saturday morning.
Thanks for listening,
TechnoMage 8)

Samir
Posts: 384
Joined: 16 Jul 2013 12:00
Location: HSV
Contact:

Re: deleting stubborn folders/files

#8 Post by Samir » 09 Sep 2013 15:09

TechnoMage wrote:I still run XP on a FAT-32 formatted hard drive. It's faster than NTFS and I can access any file on the HD from my DOS boot disk.
Permissions? Forgetaboutit!!!
Me too. :mrgreen: Did you know hard drive data recovery companies charge more for NTFS? Yep, FAT/FAT12/FAT16/FAT32 is still the standard. 8)

Post Reply