Delete many files, need help for creating
Moderator: DosItHelp
-
- Posts: 5
- Joined: 03 Jan 2018 02:32
Delete many files, need help for creating
I wanna delete many files for cleaning the hd.
But win does only offer
del and then I must jump to every directory and I wanna delete some thousands files.
The files are dirt like
*.fmt
*.bak
or 1.gif with one kb
and this came from downloading.
So how can I write a batch file for dos
which is deleting the files I want like
test123.txt
but
name.txt
should not be deleted.
I wrote a batch for my own files and there I delete
every directory once a week file by file
but I know the files and the directories.
The problem is there an many unknown directories
and how can I find them and clean one by one with a batch task?
Thank You.
I m sure
del *.fmt /s
ist not possible, isnt it?
But win does only offer
del and then I must jump to every directory and I wanna delete some thousands files.
The files are dirt like
*.fmt
*.bak
or 1.gif with one kb
and this came from downloading.
So how can I write a batch file for dos
which is deleting the files I want like
test123.txt
but
name.txt
should not be deleted.
I wrote a batch for my own files and there I delete
every directory once a week file by file
but I know the files and the directories.
The problem is there an many unknown directories
and how can I find them and clean one by one with a batch task?
Thank You.
I m sure
del *.fmt /s
ist not possible, isnt it?
Re: Delete many files, need help for creating
https://www.dostips.com/DosCommandIndex.php#DEL
... or use FORFILES
... not sure though.
Everything untested so far...
Steffen
del and then I must jump to every directory and I wanna delete some thousands files.
The files are dirt like
*.fmt
*.bak
Code: Select all
del /f /s /q /a *.fmt *.bak
or 1.gif with one kb
Code: Select all
for /f "delims=" %%i in ('dir /a-d /b /s *.gif') do if %%~zi leq 1024 del /f /a "%%~i"
We are talking about Windows, don't we?So how can I write a batch file for dos
Most likely you want to use a pattern likewhich is deleting the files I want like
test123.txt
but
name.txt
should not be deleted.
Code: Select all
del /f /s /q /a "test*.txt"
Everything untested so far...
Steffen
-
- Posts: 5
- Joined: 03 Jan 2018 02:32
Re: Delete many files, need help for creating
Thank You for Your friendly help.
*
del /f /s /q /a *.fmt *.bak
*
SO del /s does really work? I ll try.
Thank You.
We use WIN XP but BATCH we call DOS cause its looking like DOS.
*
Do You know an URL, were there is a batch workshop for learning to use batch?
*
delims
Thank You for this task. We ll study it.
***
Is there a opportuny to find and to delete:
Delete all files created in May 2,013.
Delete all files when there a copy exists example a.gif ist in folder FILEs and in folder OLD
Delete all TEXTFILES with a word in the file for example error.
Thank You again.
**
Can del delete a diectory or can DEL delete only files?
*
del /f /s /q /a *.fmt *.bak
*
SO del /s does really work? I ll try.
Thank You.
We use WIN XP but BATCH we call DOS cause its looking like DOS.
*
Do You know an URL, were there is a batch workshop for learning to use batch?
*
delims
Thank You for this task. We ll study it.
***
Is there a opportuny to find and to delete:
Delete all files created in May 2,013.
Delete all files when there a copy exists example a.gif ist in folder FILEs and in folder OLD
Delete all TEXTFILES with a word in the file for example error.
Thank You again.
**
Can del delete a diectory or can DEL delete only files?
Re: Delete many files, need help for creating
Did you happen to read the help file for the DEL command by typing del /? or help del at the command prompt?newbieasking wrote: ↑04 Jan 2018 08:01del /f /s /q /a *.fmt *.bak
SO del /s does really work? I ll try.
Well you could start at the main DosTips website.newbieasking wrote: ↑04 Jan 2018 08:01Do You know an URL, were there is a batch workshop for learning to use batch?
-
- Posts: 5
- Joined: 03 Jan 2018 02:32
Re: Delete many files, need help for creating
Another problem, thank You again.
del /f /s /q /a *.fmt
So I think its possible to do something like:
del /f /s /q /a c:\dir1/dir2/dir3/*.fmt
so del should see only the directory
c:\dir1/dir2/dir3
and del is ignoring the rest of the HD.
Is that task ok:
del /f /s /q /a c:\dir1/dir2/dir3/*.fmt
Sorry we are beginners.
del /f /s /q /a *.fmt
So I think its possible to do something like:
del /f /s /q /a c:\dir1/dir2/dir3/*.fmt
so del should see only the directory
c:\dir1/dir2/dir3
and del is ignoring the rest of the HD.
Is that task ok:
del /f /s /q /a c:\dir1/dir2/dir3/*.fmt
Sorry we are beginners.
Re: Delete many files, need help for creating
Why ask if it is ok? Test it instead and see what it does. If it doesn't do what you want it to do then ask a question.newbieasking wrote: ↑04 Jan 2018 08:56Another problem, thank You again.
del /f /s /q /a *.fmt
So I think its possible to do something like:
del /f /s /q /a c:\dir1/dir2/dir3/*.fmt
so del should see only the directory
c:\dir1/dir2/dir3
and del is ignoring the rest of the HD.
Is that task ok:
del /f /s /q /a c:\dir1/dir2/dir3/*.fmt
Sorry we are beginners.
-
- Posts: 5
- Joined: 03 Jan 2018 02:32
Re: Delete many files, need help for creating
I ask
because I dont wanna delete good files.
Delete is delete and we did delete so many good files by bad concentration.
So the task ist fine.
Thank You.
because I dont wanna delete good files.
Delete is delete and we did delete so many good files by bad concentration.
So the task ist fine.
Thank You.
Re: Delete many files, need help for creating
What is stopping you from creating a TEST folder to test code on?
Why not create a folder: C:\testing\dir1\dir2\dir3
Copy or create a bunch of random files in it.
And test your command.
-
- Posts: 5
- Joined: 03 Jan 2018 02:32
Re: Delete many files, need help for creating
Dont worry.
Yesterday we filled a USB Stick with fake files and we did start experiencing.
Delete is dangerous.
So You can see we are beginners so some quetions more:
1
Can we ask
delete all files with fmt in the directory filesjanuary and tell me
how many files did You delete?
2
Tell me also how much free space did You create.
3
Do a list of all deleted files in a textfile result.txt.
4
How can I say
delete is and its gone
and
as other way put the files in the waste paper basket so I can control it before I delete it forever.
5
How can I solve this problem
we have it on our testfiles:
a
There are many files from downloading with the nam a or y or so
and not a.png or a.jpg just a
So we did
del a
and then all other "A" files are deleted also
so how can I tell the system:
delete onyl a but dont delete a.jpg
or what did we do wrong?
Regards and again thank You for the professional help.
Yesterday we filled a USB Stick with fake files and we did start experiencing.
Delete is dangerous.
So You can see we are beginners so some quetions more:
1
Can we ask
delete all files with fmt in the directory filesjanuary and tell me
how many files did You delete?
2
Tell me also how much free space did You create.
3
Do a list of all deleted files in a textfile result.txt.
4
How can I say
delete is and its gone
and
as other way put the files in the waste paper basket so I can control it before I delete it forever.
5
How can I solve this problem
we have it on our testfiles:
a
There are many files from downloading with the nam a or y or so
and not a.png or a.jpg just a
So we did
del a
and then all other "A" files are deleted also
so how can I tell the system:
delete onyl a but dont delete a.jpg
or what did we do wrong?
Regards and again thank You for the professional help.